diff --git a/plugin/test__if_karma_or_jest/unit/attributes__if_plugin-scaffold-basic/color.spec.ext b/plugin/test__if_karma_or_jest/unit/attributes__if_plugin-scaffold-basic/color.spec.ext index 913f6ca..640a2a5 100644 --- a/plugin/test__if_karma_or_jest/unit/attributes__if_plugin-scaffold-basic/color.spec.ext +++ b/plugin/test__if_karma_or_jest/unit/attributes__if_plugin-scaffold-basic/color.spec.ext @@ -11,7 +11,7 @@ describe('color attribute', () => { } }); - it('sets font color', done => { + it('sets font color', async () => { let model = {color: 'green'}; component = StageComponent @@ -24,13 +24,8 @@ describe('color attribute', () => { .inView('<p color.bind="color"></p>') .boundTo(model); - component.create(bootstrap).then(() => { - const view = component.element; - expect(view.style.color).toBe('green'); - done(); - }).catch(e => { - fail(e); - done(); - }); + await component.create(bootstrap); + const view = component.element; + expect(view.style.color).toBe('green'); }); }); diff --git a/plugin/test__if_karma_or_jest/unit/binding-behaviors__if_plugin-scaffold-basic/primary-click.spec.ext b/plugin/test__if_karma_or_jest/unit/binding-behaviors__if_plugin-scaffold-basic/primary-click.spec.ext index aa2979c..0e8dcf4 100644 --- a/plugin/test__if_karma_or_jest/unit/binding-behaviors__if_plugin-scaffold-basic/primary-click.spec.ext +++ b/plugin/test__if_karma_or_jest/unit/binding-behaviors__if_plugin-scaffold-basic/primary-click.spec.ext @@ -28,7 +28,7 @@ describe('primaryClick binding behavior', () => { } }); - it('sets font color', done => { + it('sets font color', async () => { let hitted = false; function hit() { hitted = true; } @@ -45,19 +45,16 @@ describe('primaryClick binding behavior', () => { .boundTo(model); let view; - component.create(bootstrap).then(() => { - view = component.element; - fireEvent(view, 'click', {button: 0}); - }).then(delay).then(() => { - expect(hitted).toBe(true); - hitted = false; - fireEvent(view, 'click', {button: 1}); - }).then(delay).then(() => { - expect(hitted).toBe(false); - done(); - }).catch(e => { - fail(e); - done(); - }); + await component.create(bootstrap); + view = component.element; + fireEvent(view, 'click', {button: 0}); + await delay(); + + expect(hitted).toBe(true); + hitted = false; + fireEvent(view, 'click', {button: 1}); + await delay(); + + expect(hitted).toBe(false); }); }); diff --git a/plugin/test__if_karma_or_jest/unit/elements/hello-world.spec.ext b/plugin/test__if_karma_or_jest/unit/elements/hello-world.spec.ext index d1a7b70..b376fb0 100644 --- a/plugin/test__if_karma_or_jest/unit/elements/hello-world.spec.ext +++ b/plugin/test__if_karma_or_jest/unit/elements/hello-world.spec.ext @@ -11,7 +11,7 @@ describe('hello-world element', () => { } }); - it('says hello world with message', done => { + it('says hello world with message', async () => { let model = {message: 'from me'}; component = StageComponent @@ -24,13 +24,8 @@ describe('hello-world element', () => { .inView('<hello-world message.bind="message"></hello-world>') .boundTo(model); - component.create(bootstrap).then(() => { - const view = component.element; - expect(view.textContent.trim()).toBe('Hello world from me'); - done(); - }).catch(e => { - fail(e); - done(); - }); + await component.create(bootstrap); + const view = component.element; + expect(view.textContent.trim()).toBe('Hello world from me'); }); }); diff --git a/scaffold-minimum/test__if_karma_or_jest/unit/app.spec.ext b/scaffold-minimum/test__if_karma_or_jest/unit/app.spec.ext index 467fdc8..c18821d 100644 --- a/scaffold-minimum/test__if_karma_or_jest/unit/app.spec.ext +++ b/scaffold-minimum/test__if_karma_or_jest/unit/app.spec.ext @@ -20,14 +20,9 @@ describe('Stage App Component', () => { afterEach(() => component.dispose()); - it('should render message', done => { - component.create(bootstrap).then(() => { - const view = component.element; - expect(view.textContent.trim()).toBe('Hello World!'); - done(); - }).catch(e => { - fail(e); - done(); - }); + it('should render message', async () => { + await component.create(bootstrap); + const view = component.element; + expect(view.textContent.trim()).toBe('Hello World!'); }); }); diff --git a/scaffold-navigation/test__if_karma_or_jest/unit__if_babel/users.spec.js b/scaffold-navigation/test__if_karma_or_jest/unit__if_babel/users.spec.js index 5b55704..312ae61 100644 --- a/scaffold-navigation/test__if_karma_or_jest/unit__if_babel/users.spec.js +++ b/scaffold-navigation/test__if_karma_or_jest/unit__if_babel/users.spec.js @@ -9,22 +9,19 @@ class HttpStub { }); } - configure(func) { - } + configure(func) { /**/ } } describe('the Users module', () => { - it('sets fetch response to users', (done) => { + it('sets fetch response to users', async () => { var http = new HttpStub(); var sut = new Users(http); var itemStubs = [1]; var itemFake = [2]; http.itemStub = itemStubs; - sut.activate().then(() => { - expect(sut.users).toBe(itemStubs); - expect(sut.users).not.toBe(itemFake); - done(); - }); + await sut.activate(); + expect(sut.users).toBe(itemStubs); + expect(sut.users).not.toBe(itemFake); }); }); diff --git a/scaffold-navigation/test__if_karma_or_jest/unit__if_typescript/users.spec.ts b/scaffold-navigation/test__if_karma_or_jest/unit__if_typescript/users.spec.ts index 41d8b20..7965ea7 100644 --- a/scaffold-navigation/test__if_karma_or_jest/unit__if_typescript/users.spec.ts +++ b/scaffold-navigation/test__if_karma_or_jest/unit__if_typescript/users.spec.ts @@ -3,13 +3,13 @@ import {HttpClient} from 'aurelia-fetch-client'; class HttpStub { items: any[]; - + fetch(url) { return new Promise(resolve => { resolve({ json: () => this.items }); }); } - + configure(func) { /**/ } } @@ -18,19 +18,16 @@ function createHttpStub(): any { } describe('the Users module', () => { + it('sets fetch response to users', async () => { + const http = createHttpStub(); + const sut = new Users(<HttpClient>http), + const itemStubs = [1]; + const itemFake = [2]; - it('sets fetch response to users', (done) => { - const http = createHttpStub(), - sut = new Users(<HttpClient>http), - itemStubs = [1], - itemFake = [2]; - http.items = itemStubs; - - sut.activate().then(() => { - expect(sut.users).toBe(itemStubs); - expect(sut.users).not.toBe(itemFake); - done(); - }); + + await sut.activate(); + expect(sut.users).toBe(itemStubs); + expect(sut.users).not.toBe(itemFake); }); });