-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.spec.js
71 lines (62 loc) · 1.53 KB
/
index.spec.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
const assert = require('chai').assert; // @see http://chaijs.com/api/assert/
const testUpstreamChanges = require('./index').testUpstreamChanges;
describe('pointing-fingers', () => {
it('works without mocha integration', () => {
return testUpstreamChanges({
learn: false,
fixtures: 'fixtures/',
urls: [
'https://api.github.com/user'
],
ignores: [
'headers'
]
});
});
describe('mocha integration', () => {
testUpstreamChanges({
learn: false,
fixtures: 'fixtures/',
runner: it,
assert: assert.deepEqual,
urls: [
'https://api.github.com/user'
],
ignores: [
'headers'
]
});
});
describe('more exotic options', () => {
testUpstreamChanges({
learn: false,
fixtures: 'fixtures/',
runner: it,
assert: assert.deepEqual,
base: 'https://api.github.com',
urls: [
'/user',
'/orgs/futurice',
{
url: '/users/jareware',
ignores: [
'data.updated_at',
'headers'
]
}
],
placeholder: 'IGNORED IN TEST SUITE',
ignores: [
'headers.date',
'headers.last-modified',
'headers.etag',
[ 'headers', 'x-github-request-id' ],
[ 'headers', 'x-served-by' ],
[ 'headers', 'x-ratelimit-reset' ]
],
transforms: [
res => res.headers['x-ratelimit-remaining'] = !!res.headers['x-ratelimit-remaining'].match(/^\d+$/)
]
});
});
});