@api-client/core 0.14.9 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/RELEASE.md +163 -0
- package/RELEASE_SETUP.md +235 -0
- package/build/src/events/authorization/AuthorizationEvents.d.ts +1 -1
- package/build/src/events/authorization/AuthorizationEvents.d.ts.map +1 -1
- package/build/src/events/authorization/AuthorizationEvents.js +1 -1
- package/build/src/events/authorization/AuthorizationEvents.js.map +1 -1
- package/build/src/events/cookies/CookieEvents.d.ts +1 -1
- package/build/src/events/cookies/CookieEvents.d.ts.map +1 -1
- package/build/src/events/cookies/CookieEvents.js +1 -1
- package/build/src/events/cookies/CookieEvents.js.map +1 -1
- package/build/src/modeling/DataDomain.d.ts +45 -3
- package/build/src/modeling/DataDomain.d.ts.map +1 -1
- package/build/src/modeling/DataDomain.js +81 -3
- package/build/src/modeling/DataDomain.js.map +1 -1
- package/build/src/modeling/DomainElement.d.ts +7 -0
- package/build/src/modeling/DomainElement.d.ts.map +1 -1
- package/build/src/modeling/DomainElement.js +14 -0
- package/build/src/modeling/DomainElement.js.map +1 -1
- package/build/src/modeling/DomainImpactAnalysis.d.ts +22 -119
- package/build/src/modeling/DomainImpactAnalysis.d.ts.map +1 -1
- package/build/src/modeling/DomainImpactAnalysis.js +49 -155
- package/build/src/modeling/DomainImpactAnalysis.js.map +1 -1
- package/build/src/modeling/DomainValidation.d.ts +8 -0
- package/build/src/modeling/DomainValidation.d.ts.map +1 -0
- package/build/src/modeling/DomainValidation.js +99 -0
- package/build/src/modeling/DomainValidation.js.map +1 -0
- package/build/src/modeling/types.d.ts +70 -0
- package/build/src/modeling/types.d.ts.map +1 -1
- package/build/src/modeling/types.js.map +1 -1
- package/build/src/modeling/validation/entity_validation.js +1 -1
- package/build/src/modeling/validation/entity_validation.js.map +1 -1
- package/build/src/modeling/validation/rules.d.ts +2 -3
- package/build/src/modeling/validation/rules.d.ts.map +1 -1
- package/build/src/modeling/validation/rules.js.map +1 -1
- package/build/src/modeling/validation/semantic_validation.d.ts +31 -0
- package/build/src/modeling/validation/semantic_validation.d.ts.map +1 -0
- package/build/src/modeling/validation/semantic_validation.js +126 -0
- package/build/src/modeling/validation/semantic_validation.js.map +1 -0
- package/build/tsconfig.tsbuildinfo +1 -1
- package/data/models/example-generator-api.json +12 -12
- package/noop.ts +3 -0
- package/package.json +9 -4
- package/src/events/authorization/AuthorizationEvents.ts +1 -1
- package/src/events/cookies/CookieEvents.ts +1 -1
- package/src/modeling/DataDomain.ts +84 -3
- package/src/modeling/DomainElement.ts +16 -0
- package/src/modeling/DomainImpactAnalysis.ts +54 -239
- package/src/modeling/DomainValidation.ts +105 -0
- package/src/modeling/types.ts +86 -0
- package/src/modeling/validation/entity_validation.ts +1 -1
- package/src/modeling/validation/rules.ts +2 -4
- package/src/modeling/validation/semantic_validation.ts +145 -0
- package/tests/unit/events/EventsTestHelpers.ts +16 -0
- package/tests/unit/events/amf.spec.ts +151 -0
- package/tests/unit/events/authorization.spec.ts +150 -0
- package/tests/unit/events/cookie.spec.ts +274 -0
- package/tests/unit/events/encryption.spec.ts +108 -0
- package/tests/unit/events/events_polyfills.ts +77 -0
- package/tests/unit/events/process.spec.ts +120 -0
- package/tests/unit/events/reporting.spec.ts +82 -0
- package/tests/unit/events/telemetry.spec.ts +224 -0
- package/tests/unit/events/transport.spec.ts +139 -0
- package/tests/unit/modeling/data_domain_foreign.spec.ts +244 -0
- package/tests/unit/modeling/domain_impact_analysis.spec.ts +0 -110
- package/tests/unit/modeling/domain_validation.spec.ts +94 -0
- package/tests/unit/modeling/validation/semantic_validation.spec.ts +91 -0
- package/tests/unit/models/environment.spec.ts +574 -0
- package/tests/unit/models/error_response.spec.ts +183 -0
- package/tests/unit/models/headers_array.spec.ts +86 -0
- package/tests/unit/models/http-actions/assertion/equal_assertion.spec.ts +103 -0
- package/tests/unit/models/http-actions/assertion/greater_than_assertion.spec.ts +91 -0
- package/tests/unit/models/http-actions/assertion/includes_assertion.spec.ts +71 -0
- package/tests/unit/models/http-actions/assertion/less_than_assertion.spec.ts +91 -0
- package/tests/unit/models/http-actions/assertion/matches_assertion.spec.ts +71 -0
- package/tests/unit/models/http-actions/assertion/matches_schema_assertion.spec.ts +117 -0
- package/tests/unit/models/http-actions/assertion/not_equal_assertion.spec.ts +103 -0
- package/tests/unit/models/http-actions/assertion/not_includes_assertion.spec.ts +71 -0
- package/tests/unit/models/http-actions/assertion/not_ok_assertion.spec.ts +47 -0
- package/tests/unit/models/http-actions/assertion/not_to_be_assertion.spec.ts +72 -0
- package/tests/unit/models/http-actions/assertion/ok_assertion.spec.ts +44 -0
- package/tests/unit/models/http-actions/assertion/to_be_assertion.spec.ts +71 -0
- package/tests/unit/models/http-actions/transformation/as_lower_case_step.spec.ts +47 -0
- package/tests/unit/models/http-actions/transformation/as_number_step.spec.ts +47 -0
- package/tests/unit/models/http-actions/transformation/as_upper_case_step.spec.ts +47 -0
- package/tests/unit/models/http-actions/transformation/round_step.spec.ts +69 -0
- package/tests/unit/models/http-actions/transformation/substring_step.spec.ts +85 -0
- package/tests/unit/models/http-actions/transformation/trim_step.spec.ts +44 -0
- package/tests/unit/models/http_cookie.spec.ts +516 -0
- package/tests/unit/models/http_history.spec.ts +443 -0
- package/tests/unit/models/project_folder.spec.ts +926 -0
- package/tests/unit/models/project_item.spec.ts +137 -0
- package/tests/unit/models/project_request.spec.ts +1047 -0
- package/tests/unit/models/project_schema.spec.ts +236 -0
- package/tests/unit/models/property.spec.ts +625 -0
- package/tests/unit/models/provider.spec.ts +102 -0
- package/tests/unit/models/request.spec.ts +1206 -0
- package/tests/unit/models/request_log.spec.ts +308 -0
- package/tests/unit/models/request_time.spec.ts +138 -0
- package/tests/unit/models/response_redirect.spec.ts +303 -0
- package/tests/unit/models/sent_request.spec.ts +206 -0
- package/tests/unit/models/server.spec.ts +195 -0
- package/tests/unit/models/thing.spec.ts +154 -0
- package/build/oauth-popup.html +0 -33
- /package/tests/unit/models/{Certificate.spec.ts → certificate.spec.ts} +0 -0
- /package/tests/unit/models/{HostRule.spec.ts → host_rule.spec.ts} +0 -0
- /package/tests/unit/models/{HttpProject.spec.ts → http_project.spec.ts} +0 -0
- /package/tests/unit/models/{HttpRequest.spec.ts → http_request.spec.ts} +0 -0
- /package/tests/unit/models/{HttpResponse.spec.ts → http_response.spec.ts} +0 -0
- /package/tests/unit/models/{License.spec.ts → license.spec.ts} +0 -0
- /package/tests/unit/models/{Response.spec.ts → response.spec.ts} +0 -0
|
@@ -0,0 +1,443 @@
|
|
|
1
|
+
import { test } from '@japa/runner'
|
|
2
|
+
import { assert } from '@esm-bundle/chai'
|
|
3
|
+
import {
|
|
4
|
+
HttpHistory,
|
|
5
|
+
IHttpHistory,
|
|
6
|
+
createdSymbol,
|
|
7
|
+
midnightSymbol,
|
|
8
|
+
Kind as HttpHistoryKind,
|
|
9
|
+
} from '../../../src/models/HttpHistory.js'
|
|
10
|
+
import { SentRequest, ISentRequest } from '../../../src/models/SentRequest.js'
|
|
11
|
+
import { RequestLog, Kind as RequestLogKind } from '../../../src/models/RequestLog.js'
|
|
12
|
+
import { Kind as HttpRequestKind } from '../../../src/models/HttpRequest.js'
|
|
13
|
+
|
|
14
|
+
test.group('HttpHistory #created', () => {
|
|
15
|
+
test('sets the value', () => {
|
|
16
|
+
const instance = new HttpHistory()
|
|
17
|
+
instance.created = 1234
|
|
18
|
+
assert.equal(instance.created, 1234)
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
test('sets the current time when value is missing', () => {
|
|
22
|
+
const instance = new HttpHistory()
|
|
23
|
+
const now = Date.now()
|
|
24
|
+
instance.created = undefined
|
|
25
|
+
assert.approximately(instance.created, now, 100)
|
|
26
|
+
})
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
test.group('HttpHistory #midnight', () => {
|
|
30
|
+
test('sets the value', () => {
|
|
31
|
+
const instance = new HttpHistory()
|
|
32
|
+
instance.midnight = 1234
|
|
33
|
+
assert.equal(instance.midnight, 1234)
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
test('sets the default value when the value is missing', () => {
|
|
37
|
+
const instance = new HttpHistory()
|
|
38
|
+
instance[createdSymbol] = 1641774295483
|
|
39
|
+
instance.midnight = undefined
|
|
40
|
+
// assert.equal(instance.midnight, 1641715200000);
|
|
41
|
+
assert.typeOf(instance.midnight, 'number')
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
test('reads the default value when not set', () => {
|
|
45
|
+
const instance = new HttpHistory()
|
|
46
|
+
instance[createdSymbol] = 1641774295483
|
|
47
|
+
// @ts-expect-error Used in testing
|
|
48
|
+
instance[midnightSymbol] = undefined
|
|
49
|
+
// assert.equal(instance.midnight, 1641715200000);
|
|
50
|
+
assert.typeOf(instance.midnight, 'number')
|
|
51
|
+
})
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
test.group('HttpHistory constructor()', () => {
|
|
55
|
+
test('creates the default values', () => {
|
|
56
|
+
const now = Date.now()
|
|
57
|
+
const instance = new HttpHistory()
|
|
58
|
+
assert.equal(instance.kind, HttpHistoryKind)
|
|
59
|
+
assert.typeOf(instance.created, 'number')
|
|
60
|
+
assert.approximately(instance.created, now, 100)
|
|
61
|
+
const { log } = instance
|
|
62
|
+
assert.typeOf(log, 'object', 'sets the log')
|
|
63
|
+
assert.equal(instance.user, '')
|
|
64
|
+
assert.equal(instance.organization, '')
|
|
65
|
+
assert.equal(instance.project, '')
|
|
66
|
+
assert.equal(instance.request, '')
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
test('creates values from the schema', () => {
|
|
70
|
+
const now = Date.now()
|
|
71
|
+
const schema: IHttpHistory = {
|
|
72
|
+
kind: HttpHistoryKind,
|
|
73
|
+
created: now,
|
|
74
|
+
user: 'u1',
|
|
75
|
+
organization: 's1',
|
|
76
|
+
project: 'p1',
|
|
77
|
+
request: 'r1',
|
|
78
|
+
app: 'a1',
|
|
79
|
+
key: '',
|
|
80
|
+
log: {
|
|
81
|
+
kind: RequestLogKind,
|
|
82
|
+
request: {
|
|
83
|
+
kind: HttpRequestKind,
|
|
84
|
+
url: 'https://dot.com',
|
|
85
|
+
headers: 'x-test: true',
|
|
86
|
+
method: 'PUT',
|
|
87
|
+
startTime: 0,
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
}
|
|
91
|
+
const instance = new HttpHistory(schema)
|
|
92
|
+
|
|
93
|
+
assert.equal(instance.kind, HttpHistoryKind)
|
|
94
|
+
assert.equal(instance.created, now)
|
|
95
|
+
assert.equal(instance.user, 'u1')
|
|
96
|
+
assert.equal(instance.organization, 's1')
|
|
97
|
+
assert.equal(instance.project, 'p1')
|
|
98
|
+
assert.equal(instance.project, 'p1')
|
|
99
|
+
assert.equal(instance.request, 'r1')
|
|
100
|
+
assert.equal(instance.app, 'a1')
|
|
101
|
+
|
|
102
|
+
const { log } = instance
|
|
103
|
+
assert.typeOf(log, 'object', 'sets the log')
|
|
104
|
+
assert.typeOf(log.request, 'object', 'sets the log.request')
|
|
105
|
+
const request = log.request as SentRequest
|
|
106
|
+
assert.equal(request.method, 'PUT')
|
|
107
|
+
assert.equal(request.url, 'https://dot.com')
|
|
108
|
+
})
|
|
109
|
+
|
|
110
|
+
test('creates values from the JSON schema string', () => {
|
|
111
|
+
const now = Date.now()
|
|
112
|
+
const schema: IHttpHistory = {
|
|
113
|
+
kind: HttpHistoryKind,
|
|
114
|
+
created: now,
|
|
115
|
+
user: 'u1',
|
|
116
|
+
organization: 's1',
|
|
117
|
+
project: 'p1',
|
|
118
|
+
request: 'r1',
|
|
119
|
+
app: 'a1',
|
|
120
|
+
key: '',
|
|
121
|
+
log: {
|
|
122
|
+
kind: RequestLogKind,
|
|
123
|
+
request: {
|
|
124
|
+
kind: HttpRequestKind,
|
|
125
|
+
url: 'https://dot.com',
|
|
126
|
+
headers: 'x-test: true',
|
|
127
|
+
method: 'PUT',
|
|
128
|
+
startTime: 0,
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
}
|
|
132
|
+
const instance = new HttpHistory(JSON.stringify(schema))
|
|
133
|
+
|
|
134
|
+
assert.equal(instance.kind, HttpHistoryKind)
|
|
135
|
+
assert.equal(instance.created, now)
|
|
136
|
+
assert.equal(instance.user, 'u1')
|
|
137
|
+
assert.equal(instance.organization, 's1')
|
|
138
|
+
assert.equal(instance.project, 'p1')
|
|
139
|
+
assert.equal(instance.project, 'p1')
|
|
140
|
+
assert.equal(instance.request, 'r1')
|
|
141
|
+
|
|
142
|
+
const { log } = instance
|
|
143
|
+
assert.typeOf(log, 'object', 'sets the log')
|
|
144
|
+
assert.typeOf(log.request, 'object', 'sets the log.request')
|
|
145
|
+
const request = log.request as SentRequest
|
|
146
|
+
assert.equal(request.method, 'PUT')
|
|
147
|
+
assert.equal(request.url, 'https://dot.com')
|
|
148
|
+
})
|
|
149
|
+
})
|
|
150
|
+
|
|
151
|
+
test.group('HttpHistory new()', () => {
|
|
152
|
+
test('sets the passed log', () => {
|
|
153
|
+
const instance = new HttpHistory()
|
|
154
|
+
const schema = instance.toJSON()
|
|
155
|
+
schema.log.request = {
|
|
156
|
+
kind: HttpRequestKind,
|
|
157
|
+
url: 'https://dot.com',
|
|
158
|
+
headers: 'x-test: true',
|
|
159
|
+
method: 'PUT',
|
|
160
|
+
startTime: 0,
|
|
161
|
+
}
|
|
162
|
+
instance.new(schema)
|
|
163
|
+
|
|
164
|
+
const { log } = instance
|
|
165
|
+
assert.typeOf(log, 'object', 'sets the log')
|
|
166
|
+
assert.typeOf(log.request, 'object', 'sets the log.request')
|
|
167
|
+
const request = log.request as SentRequest
|
|
168
|
+
assert.equal(request.method, 'PUT')
|
|
169
|
+
assert.equal(request.url, 'https://dot.com')
|
|
170
|
+
})
|
|
171
|
+
|
|
172
|
+
test('sets the default log', () => {
|
|
173
|
+
const instance = new HttpHistory()
|
|
174
|
+
const schema = instance.toJSON()
|
|
175
|
+
instance.new(schema)
|
|
176
|
+
|
|
177
|
+
const { log } = instance
|
|
178
|
+
assert.typeOf(log, 'object', 'sets the log')
|
|
179
|
+
assert.isUndefined(log.request, 'has no log.request')
|
|
180
|
+
})
|
|
181
|
+
|
|
182
|
+
test('sets the passed key', () => {
|
|
183
|
+
const instance = new HttpHistory()
|
|
184
|
+
const schema = instance.toJSON()
|
|
185
|
+
schema.key = 'a'
|
|
186
|
+
instance.new(schema)
|
|
187
|
+
|
|
188
|
+
assert.equal(instance.key, 'a')
|
|
189
|
+
})
|
|
190
|
+
|
|
191
|
+
test('sets the default key', () => {
|
|
192
|
+
const instance = new HttpHistory()
|
|
193
|
+
instance.key = 'test'
|
|
194
|
+
const schema = instance.toJSON()
|
|
195
|
+
// @ts-expect-error Used in testing
|
|
196
|
+
delete schema.key
|
|
197
|
+
instance.new(schema)
|
|
198
|
+
|
|
199
|
+
assert.equal(instance.key, '')
|
|
200
|
+
})
|
|
201
|
+
|
|
202
|
+
test('sets the passed organization', () => {
|
|
203
|
+
const instance = new HttpHistory()
|
|
204
|
+
const schema = instance.toJSON()
|
|
205
|
+
schema.organization = 'a'
|
|
206
|
+
instance.new(schema)
|
|
207
|
+
|
|
208
|
+
assert.equal(instance.organization, 'a')
|
|
209
|
+
})
|
|
210
|
+
|
|
211
|
+
test('sets the default organization', () => {
|
|
212
|
+
const instance = new HttpHistory()
|
|
213
|
+
instance.organization = 'test'
|
|
214
|
+
const schema = instance.toJSON()
|
|
215
|
+
// @ts-expect-error Used in testing
|
|
216
|
+
delete schema.organization
|
|
217
|
+
instance.new(schema)
|
|
218
|
+
|
|
219
|
+
assert.equal(instance.organization, '')
|
|
220
|
+
})
|
|
221
|
+
|
|
222
|
+
test('sets the passed app', () => {
|
|
223
|
+
const instance = new HttpHistory()
|
|
224
|
+
const schema = instance.toJSON()
|
|
225
|
+
schema.app = 'a'
|
|
226
|
+
instance.new(schema)
|
|
227
|
+
|
|
228
|
+
assert.equal(instance.app, 'a')
|
|
229
|
+
})
|
|
230
|
+
|
|
231
|
+
test('sets the default app', () => {
|
|
232
|
+
const instance = new HttpHistory()
|
|
233
|
+
instance.app = 'test'
|
|
234
|
+
const schema = instance.toJSON()
|
|
235
|
+
// @ts-expect-error Used in testing
|
|
236
|
+
delete schema.app
|
|
237
|
+
instance.new(schema)
|
|
238
|
+
|
|
239
|
+
assert.equal(instance.app, '')
|
|
240
|
+
})
|
|
241
|
+
|
|
242
|
+
test('sets the passed user', () => {
|
|
243
|
+
const instance = new HttpHistory()
|
|
244
|
+
const schema = instance.toJSON()
|
|
245
|
+
schema.user = 'a'
|
|
246
|
+
instance.new(schema)
|
|
247
|
+
|
|
248
|
+
assert.equal(instance.user, 'a')
|
|
249
|
+
})
|
|
250
|
+
|
|
251
|
+
test('sets the default user', () => {
|
|
252
|
+
const instance = new HttpHistory()
|
|
253
|
+
instance.user = 'test'
|
|
254
|
+
const schema = instance.toJSON()
|
|
255
|
+
delete schema.user
|
|
256
|
+
instance.new(schema)
|
|
257
|
+
|
|
258
|
+
assert.equal(instance.user, '')
|
|
259
|
+
})
|
|
260
|
+
|
|
261
|
+
test('sets the passed project', () => {
|
|
262
|
+
const instance = new HttpHistory()
|
|
263
|
+
const schema = instance.toJSON()
|
|
264
|
+
schema.project = 'a'
|
|
265
|
+
instance.new(schema)
|
|
266
|
+
|
|
267
|
+
assert.equal(instance.project, 'a')
|
|
268
|
+
})
|
|
269
|
+
|
|
270
|
+
test('sets the default project', () => {
|
|
271
|
+
const instance = new HttpHistory()
|
|
272
|
+
instance.project = 'test'
|
|
273
|
+
const schema = instance.toJSON()
|
|
274
|
+
// @ts-expect-error Used in testing
|
|
275
|
+
delete schema.project
|
|
276
|
+
instance.new(schema)
|
|
277
|
+
|
|
278
|
+
assert.equal(instance.project, '')
|
|
279
|
+
})
|
|
280
|
+
|
|
281
|
+
test('sets the passed request', () => {
|
|
282
|
+
const instance = new HttpHistory()
|
|
283
|
+
const schema = instance.toJSON()
|
|
284
|
+
schema.request = 'a'
|
|
285
|
+
instance.new(schema)
|
|
286
|
+
|
|
287
|
+
assert.equal(instance.request, 'a')
|
|
288
|
+
})
|
|
289
|
+
|
|
290
|
+
test('sets the default request', () => {
|
|
291
|
+
const instance = new HttpHistory()
|
|
292
|
+
instance.request = 'test'
|
|
293
|
+
const schema = instance.toJSON()
|
|
294
|
+
// @ts-expect-error Used in testing
|
|
295
|
+
delete schema.request
|
|
296
|
+
instance.new(schema)
|
|
297
|
+
|
|
298
|
+
assert.equal(instance.request, '')
|
|
299
|
+
})
|
|
300
|
+
|
|
301
|
+
test('sets the created', () => {
|
|
302
|
+
const instance = new HttpHistory()
|
|
303
|
+
const schema = instance.toJSON()
|
|
304
|
+
schema.created = 1234567
|
|
305
|
+
instance.new(schema)
|
|
306
|
+
assert.equal(instance.created, 1234567)
|
|
307
|
+
})
|
|
308
|
+
|
|
309
|
+
test('sets the created as current time', () => {
|
|
310
|
+
const now = Date.now()
|
|
311
|
+
const instance = new HttpHistory()
|
|
312
|
+
const schema = instance.toJSON()
|
|
313
|
+
// @ts-expect-error Used in testing
|
|
314
|
+
delete schema.created
|
|
315
|
+
instance.new(schema)
|
|
316
|
+
assert.approximately(instance.created, now, 100)
|
|
317
|
+
})
|
|
318
|
+
|
|
319
|
+
test('sets the midnight', () => {
|
|
320
|
+
const instance = new HttpHistory()
|
|
321
|
+
const schema = instance.toJSON()
|
|
322
|
+
schema.midnight = 1234567
|
|
323
|
+
instance.new(schema)
|
|
324
|
+
assert.equal(instance.midnight, 1234567)
|
|
325
|
+
})
|
|
326
|
+
})
|
|
327
|
+
|
|
328
|
+
test.group('HttpHistory toJSON()', () => {
|
|
329
|
+
test('sets the log', () => {
|
|
330
|
+
const instance = new HttpHistory()
|
|
331
|
+
instance.log = RequestLog.fromRequest({
|
|
332
|
+
kind: HttpRequestKind,
|
|
333
|
+
url: 'https://dot.com',
|
|
334
|
+
headers: 'x-test: true',
|
|
335
|
+
method: 'PUT',
|
|
336
|
+
startTime: 0,
|
|
337
|
+
})
|
|
338
|
+
|
|
339
|
+
const result = instance.toJSON()
|
|
340
|
+
const data = result.log.request as ISentRequest
|
|
341
|
+
|
|
342
|
+
assert.equal(data.url, 'https://dot.com')
|
|
343
|
+
assert.equal(data.method, 'PUT')
|
|
344
|
+
assert.equal(data.headers, 'x-test: true')
|
|
345
|
+
})
|
|
346
|
+
|
|
347
|
+
test('sets the kind', () => {
|
|
348
|
+
const instance = new HttpHistory()
|
|
349
|
+
const result = instance.toJSON()
|
|
350
|
+
|
|
351
|
+
assert.equal(result.kind, HttpHistoryKind)
|
|
352
|
+
})
|
|
353
|
+
|
|
354
|
+
test('sets the created and midnight', () => {
|
|
355
|
+
const now = Date.now()
|
|
356
|
+
const instance = new HttpHistory()
|
|
357
|
+
instance.created = now
|
|
358
|
+
instance.midnight = 1234
|
|
359
|
+
|
|
360
|
+
const result = instance.toJSON()
|
|
361
|
+
|
|
362
|
+
assert.equal(result.created, now)
|
|
363
|
+
assert.equal(result.midnight, 1234)
|
|
364
|
+
})
|
|
365
|
+
|
|
366
|
+
test('sets the key', () => {
|
|
367
|
+
const instance = new HttpHistory()
|
|
368
|
+
instance.key = 'test'
|
|
369
|
+
const result = instance.toJSON()
|
|
370
|
+
assert.equal(result.key, 'test')
|
|
371
|
+
})
|
|
372
|
+
|
|
373
|
+
test('does not set the key when missing', () => {
|
|
374
|
+
const instance = new HttpHistory()
|
|
375
|
+
const result = instance.toJSON()
|
|
376
|
+
assert.equal(result.key, '')
|
|
377
|
+
})
|
|
378
|
+
|
|
379
|
+
test('sets the organization', () => {
|
|
380
|
+
const instance = new HttpHistory()
|
|
381
|
+
instance.organization = 'test'
|
|
382
|
+
const result = instance.toJSON()
|
|
383
|
+
assert.equal(result.organization, 'test')
|
|
384
|
+
})
|
|
385
|
+
|
|
386
|
+
test('does not set the organization when missing', () => {
|
|
387
|
+
const instance = new HttpHistory()
|
|
388
|
+
const result = instance.toJSON()
|
|
389
|
+
assert.equal(result.organization, '')
|
|
390
|
+
})
|
|
391
|
+
|
|
392
|
+
test('sets the app', () => {
|
|
393
|
+
const instance = new HttpHistory()
|
|
394
|
+
instance.app = 'test'
|
|
395
|
+
const result = instance.toJSON()
|
|
396
|
+
assert.equal(result.app, 'test')
|
|
397
|
+
})
|
|
398
|
+
|
|
399
|
+
test('does not set the app when missing', () => {
|
|
400
|
+
const instance = new HttpHistory()
|
|
401
|
+
const result = instance.toJSON()
|
|
402
|
+
assert.equal(result.app, '')
|
|
403
|
+
})
|
|
404
|
+
|
|
405
|
+
test('sets the project', () => {
|
|
406
|
+
const instance = new HttpHistory()
|
|
407
|
+
instance.project = 'test'
|
|
408
|
+
const result = instance.toJSON()
|
|
409
|
+
assert.equal(result.project, 'test')
|
|
410
|
+
})
|
|
411
|
+
|
|
412
|
+
test('does not set the project when missing', () => {
|
|
413
|
+
const instance = new HttpHistory()
|
|
414
|
+
const result = instance.toJSON()
|
|
415
|
+
assert.equal(result.project, '')
|
|
416
|
+
})
|
|
417
|
+
|
|
418
|
+
test('sets the user', () => {
|
|
419
|
+
const instance = new HttpHistory()
|
|
420
|
+
instance.user = 'test'
|
|
421
|
+
const result = instance.toJSON()
|
|
422
|
+
assert.equal(result.user, 'test')
|
|
423
|
+
})
|
|
424
|
+
|
|
425
|
+
test('sets the default user when missing', () => {
|
|
426
|
+
const instance = new HttpHistory()
|
|
427
|
+
const result = instance.toJSON()
|
|
428
|
+
assert.equal(result.user, '')
|
|
429
|
+
})
|
|
430
|
+
|
|
431
|
+
test('sets the request', () => {
|
|
432
|
+
const instance = new HttpHistory()
|
|
433
|
+
instance.request = 'test'
|
|
434
|
+
const result = instance.toJSON()
|
|
435
|
+
assert.equal(result.request, 'test')
|
|
436
|
+
})
|
|
437
|
+
|
|
438
|
+
test('does not set the request when missing', () => {
|
|
439
|
+
const instance = new HttpHistory()
|
|
440
|
+
const result = instance.toJSON()
|
|
441
|
+
assert.equal(result.request, '')
|
|
442
|
+
})
|
|
443
|
+
})
|