From ec2853f2b608d01a5e731adc11defcb04c161dcf Mon Sep 17 00:00:00 2001 From: TheJaredWilcurt Date: Wed, 19 Feb 2020 11:34:27 -0500 Subject: [PATCH] fix tests --- tests/unit/components/FsExample.test.js | 8 ++++++-- tests/unit/components/HelloWorld.test.js | 6 +++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/tests/unit/components/FsExample.test.js b/tests/unit/components/FsExample.test.js index 963a104..2183f6f 100644 --- a/tests/unit/components/FsExample.test.js +++ b/tests/unit/components/FsExample.test.js @@ -9,11 +9,13 @@ describe('FsExample.vue', () => { .toMatchSnapshot(); }); - test('Click button', () => { + test('Click button', async () => { const wrapper = shallowMount(FsExample); let domButton = wrapper.find('[data-test="fs-example-button"]'); domButton.trigger('click'); + await wrapper.vm.$nextTick(); + expect(window.nw.require) .toHaveBeenCalledWith('fs'); @@ -21,7 +23,7 @@ describe('FsExample.vue', () => { .toMatchSnapshot(); }); - test('Error state', () => { + test('Error state', async () => { window.nw.require.mockImplementation((module) => { if (module === 'fs') { return new Error(); @@ -32,6 +34,8 @@ describe('FsExample.vue', () => { let domButton = wrapper.find('[data-test="fs-example-button"]'); domButton.trigger('click'); + await wrapper.vm.$nextTick(); + expect(window.nw.require) .toHaveBeenCalledWith('fs'); diff --git a/tests/unit/components/HelloWorld.test.js b/tests/unit/components/HelloWorld.test.js index 9802fea..3dafd23 100644 --- a/tests/unit/components/HelloWorld.test.js +++ b/tests/unit/components/HelloWorld.test.js @@ -19,19 +19,19 @@ describe('HelloWorld.vue', () => { .toMatchSnapshot(); }); - test('Activate dev tools', () => { + test('Activate dev tools', async () => { const wrapper = shallowMount(HelloWorld); const button = wrapper.find('[data-test="toggleDevTools"]'); button.trigger('click'); - wrapper.vm.$nextTick(); + await wrapper.vm.$nextTick(); expect(wrapper.find('[data-test="toggleDevTools').html()) .toMatchSnapshot('hide'); button.trigger('click'); - wrapper.vm.$nextTick(); + await wrapper.vm.$nextTick(); expect(wrapper.find('[data-test="toggleDevTools').html()) .toMatchSnapshot('show');