-
Notifications
You must be signed in to change notification settings - Fork 308
/
fixtures.ts
116 lines (114 loc) · 2.92 KB
/
fixtures.ts
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
import nock from 'nock'
export const mockUSCPIResponseSuccess = (): nock.Scope =>
nock('https://api.bls.gov/publicAPI/v2', { encodedQueryParams: true })
.persist()
.get('/timeseries/data/CUSR0000SA0')
.reply(
200,
{
status: 'REQUEST_SUCCEEDED',
responseTime: 212,
message: [],
Results: {
series: [
{
seriesID: 'CUSR0000SA0',
data: [
{
year: '2021',
period: 'M09',
periodName: 'September',
latest: 'true',
value: '274.138',
footnotes: [{}],
},
{
year: '2021',
period: 'M08',
periodName: 'August',
value: '273.012',
footnotes: [{}],
},
{
year: '2021',
period: 'M07',
periodName: 'July',
value: '272.265',
footnotes: [{}],
},
],
},
],
},
},
[
'Date',
'Wed, 22 Sep 2021 14:24:17 GMT',
'Content-Type',
'application/json',
'Content-Length',
'152',
'Connection',
'close',
'Server',
'nginx',
'Vary',
'Origin',
],
)
export const mockAuthenticatedSuccess = (): nock.Scope =>
nock('https://api.bls.gov/publicAPI/v2', { encodedQueryParams: true })
.get(`/timeseries/data/CUSR0000SA0?registrationkey=testkey`)
.reply(
200,
{
status: 'REQUEST_SUCCEEDED',
responseTime: 212,
message: [],
Results: {
series: [
{
seriesID: 'CUSR0000SA0',
data: [
{
year: '2021',
period: 'M09',
periodName: 'September',
latest: 'true',
value: '274.138',
footnotes: [{}],
},
{
year: '2021',
period: 'M08',
periodName: 'August',
value: '273.012',
footnotes: [{}],
},
{
year: '2021',
period: 'M07',
periodName: 'July',
value: '271.123', // Using a different value than the authenticated one, just to differentiate
footnotes: [{}],
},
],
},
],
},
},
[
'Date',
'Wed, 22 Sep 2021 14:24:17 GMT',
'Content-Type',
'application/json',
'Content-Length',
'152',
'Connection',
'close',
'Server',
'nginx',
'Vary',
'Origin',
],
)