fix tests

This commit is contained in:
TheJaredWilcurt 2020-02-19 11:34:27 -05:00
parent 0cbdf6b8a1
commit ec2853f2b6
2 changed files with 9 additions and 5 deletions

View File

@ -9,11 +9,13 @@ describe('FsExample.vue', () => {
.toMatchSnapshot(); .toMatchSnapshot();
}); });
test('Click button', () => { test('Click button', async () => {
const wrapper = shallowMount(FsExample); const wrapper = shallowMount(FsExample);
let domButton = wrapper.find('[data-test="fs-example-button"]'); let domButton = wrapper.find('[data-test="fs-example-button"]');
domButton.trigger('click'); domButton.trigger('click');
await wrapper.vm.$nextTick();
expect(window.nw.require) expect(window.nw.require)
.toHaveBeenCalledWith('fs'); .toHaveBeenCalledWith('fs');
@ -21,7 +23,7 @@ describe('FsExample.vue', () => {
.toMatchSnapshot(); .toMatchSnapshot();
}); });
test('Error state', () => { test('Error state', async () => {
window.nw.require.mockImplementation((module) => { window.nw.require.mockImplementation((module) => {
if (module === 'fs') { if (module === 'fs') {
return new Error(); return new Error();
@ -32,6 +34,8 @@ describe('FsExample.vue', () => {
let domButton = wrapper.find('[data-test="fs-example-button"]'); let domButton = wrapper.find('[data-test="fs-example-button"]');
domButton.trigger('click'); domButton.trigger('click');
await wrapper.vm.$nextTick();
expect(window.nw.require) expect(window.nw.require)
.toHaveBeenCalledWith('fs'); .toHaveBeenCalledWith('fs');

View File

@ -19,19 +19,19 @@ describe('HelloWorld.vue', () => {
.toMatchSnapshot(); .toMatchSnapshot();
}); });
test('Activate dev tools', () => { test('Activate dev tools', async () => {
const wrapper = shallowMount(HelloWorld); const wrapper = shallowMount(HelloWorld);
const button = wrapper.find('[data-test="toggleDevTools"]'); const button = wrapper.find('[data-test="toggleDevTools"]');
button.trigger('click'); button.trigger('click');
wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
expect(wrapper.find('[data-test="toggleDevTools').html()) expect(wrapper.find('[data-test="toggleDevTools').html())
.toMatchSnapshot('hide'); .toMatchSnapshot('hide');
button.trigger('click'); button.trigger('click');
wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
expect(wrapper.find('[data-test="toggleDevTools').html()) expect(wrapper.find('[data-test="toggleDevTools').html())
.toMatchSnapshot('show'); .toMatchSnapshot('show');