-
Notifications
You must be signed in to change notification settings - Fork 64
/
test.js
34 lines (31 loc) · 867 Bytes
/
test.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
const fs = require('fs')
const nock = require('nock')
const mockDataFilename = './mock-data.json'
before(() => {
if (process.env.RECORD_MOCK_DATA) {
nock.recorder.rec({
output_objects: true,
dont_print: true,
})
} else {
nock.load(mockDataFilename)
}
})
after(() => {
if (process.env.RECORD_MOCK_DATA) {
const nockCallObjects = nock.recorder.play()
const noLocalhost = nockCallObjects.filter((o) => {
return ![
'http://localhost:3101',
'http://www.m5.is:80',
'http://hraun.vedur.is:80',
'http://www.vedur.is:80',
'http://www.landspitali.is:80',
'http://fotbolti.net:80',
'http://skoli.landsbjorg.is:80',
'http://www.worldfengur.com:80',
].includes(o.scope)
})
fs.writeFileSync(mockDataFilename, JSON.stringify(noLocalhost, null, 2))
}
})