-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtodosSpec.js
43 lines (35 loc) · 1.09 KB
/
todosSpec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import window from 'global';
import hypermonkey from 'hypermonkey';
import App from '../browser/app';
import ServerApp from '../lib/app';
import pageHelper from './pageHelper';
describe('todos app', () => {
var page, monkey;
beforeEach(() => {
monkey = hypermonkey()
.withServer('http://localhost:1234', ServerApp)
.withApp(router => new App({router: router}))
.start();
page = pageHelper(monkey.browser);
});
afterEach(() => monkey.stop());
context('when user lands on "/"', () => {
beforeEach(() => {
window.history.pushState(null, null, '/');
});
it('allows user to fetch todos', async () => {
await page.fetchTODOs();
await page.observeLoadingBar();
await page.expectTODOs('buy beer', 'call Dave', 'watch tv');
});
});
context('when user lands on "/todos"', () => {
beforeEach(() => {
window.history.pushState(null, null, '/todos');
});
it('fetches todos automatically', async () => {
await page.observeLoadingBar();
await page.expectTODOs('buy beer', 'call Dave', 'watch tv');
});
});
});