forked from cerebral/overmind
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheffecttest.ts
More file actions
39 lines (35 loc) · 795 Bytes
/
effecttest.ts
File metadata and controls
39 lines (35 loc) · 795 Bytes
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
export default () => [
{
fileName: 'overmind/effects.test.ts',
code: `
import { Api } from './effects'
describe('Effects', () => {
describe('Api', () => {
test('should get a post using baseUrl and authToken in header', async () => {
expect.assertions(3)
const api = new Api({
get(url, config) {
expect(url).toBe('/test/posts/1')
expect(config).toEqual({
headers: {
'Auth-Token': '123'
}
})
return Promise.resolve({
response: {
id
}
})
}
}, {
authToken: '123',
baseUrl: '/test'
})
const post = await api.getPost('1')
expect(post.id).toBe('1')
})
})
})
`,
},
]