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();
});
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');

View File

@ -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');