Skip to content

Commit 473a540

Browse files
author
Michael Withagen
committed
fix(jest mock): Add stub for static content
Update PR based on latest code
1 parent b7aa152 commit 473a540

2 files changed

Lines changed: 28 additions & 1 deletion

File tree

skeleton/jest/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"devDependencies": {
33
"jest": "",
44
"jest-cli": "",
5+
"jest-transform-stub": "",
56
"aurelia-loader-nodejs": "",
67
"aurelia-pal-nodejs": "",
78

@@ -34,6 +35,7 @@
3435
"json"
3536
],
3637
"transform": {
38+
"^.+\\.(css|less|sass|scss|jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "jest-transform-stub",
3739
// @if feat.babel
3840
"^.+\\.js$": "babel-jest",
3941
// @endif
@@ -81,4 +83,4 @@
8183
"html"
8284
]
8385
}
84-
}
86+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,32 @@
1+
import {bootstrap} from 'aurelia-bootstrapper';
12
import {App} from '../../src/app';
3+
import {StageComponent} from 'aurelia-testing';
24

35
describe('the app', () => {
46
it('says hello', () => {
57
expect(new App().message).toBe('Hello World!');
68
});
79
});
10+
11+
describe('Stage App Component', () => {
12+
let component;
13+
14+
beforeEach(() => {
15+
component = StageComponent
16+
.withResources('app')
17+
.inView('<app></app>');
18+
});
19+
20+
afterEach(() => component.dispose());
21+
22+
it('should render message', done => {
23+
component.create(bootstrap).then(() => {
24+
const view = component.element;
25+
expect(view.textContent.trim()).toBe('Hello World!');
26+
done();
27+
}).catch(e => {
28+
fail(e);
29+
done();
30+
});
31+
});
32+
});

0 commit comments

Comments
 (0)