Fix js unit tests

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2021-04-08 09:53:46 +02:00
parent ca14745d40
commit 1a43bfb620
7 changed files with 63 additions and 17 deletions

View File

@@ -37,7 +37,7 @@ describe("CommentTree", () => {
let requestHandlers: Record<string, RequestHandler>;
const generateWrapper = (handlers = {}, baseData = {}) => {
const cache = new InMemoryCache({ addTypename: false });
const cache = new InMemoryCache({ addTypename: true });
mockClient = createMockClient({
cache,
@@ -88,10 +88,13 @@ describe("CommentTree", () => {
it("renders a comment tree", async () => {
generateWrapper();
expect(wrapper.findComponent({ name: "b-notification" }).text()).toBe(
"The organiser has chosen to close comments."
);
expect(wrapper.exists()).toBe(true);
expect(wrapper.find(".loading").text()).toBe("Loading comments…");
await wrapper.vm.$nextTick();
await wrapper.vm.$nextTick(); // because of the <transition>
expect(wrapper.find(".no-comments").text()).toBe("No comments yet");
expect(wrapper.html()).toMatchSnapshot();
});