@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,183 @@
|
|
|
1
|
+
import { test } from '@japa/runner'
|
|
2
|
+
import { HttpResponse } from '../../../src/models/HttpResponse.js'
|
|
3
|
+
import { ErrorResponse, IErrorResponse } from '../../../src/models/ErrorResponse.js'
|
|
4
|
+
import { ErrorResponse as LegacyErrorResponse } from '../../../src/models/legacy/request/ArcResponse.js'
|
|
5
|
+
import { HttpResponseKind } from '../../../src/models/kinds.js'
|
|
6
|
+
import { ISerializedError } from '../../../src/models/SerializableError.js'
|
|
7
|
+
|
|
8
|
+
test.group('Models > ErrorResponse > Initialization > Default response initialization', () => {
|
|
9
|
+
test('initializes a default project', ({ assert }) => {
|
|
10
|
+
const result = new ErrorResponse()
|
|
11
|
+
assert.equal(result.kind, HttpResponseKind, 'sets the kind property')
|
|
12
|
+
assert.equal(result.status, 0, 'sets the status property')
|
|
13
|
+
assert.equal(result.error.message, 'Unknown error', 'sets the error')
|
|
14
|
+
assert.isUndefined(result.statusText, 'has no statusText property')
|
|
15
|
+
assert.isUndefined(result.headers, 'has no headers property')
|
|
16
|
+
assert.isUndefined(result.payload, 'has no payload property')
|
|
17
|
+
})
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
test.group('Models > ErrorResponse > Initialization > From schema initialization', (group) => {
|
|
21
|
+
let base: IErrorResponse
|
|
22
|
+
group.each.setup(() => {
|
|
23
|
+
base = {
|
|
24
|
+
kind: HttpResponseKind,
|
|
25
|
+
status: 0,
|
|
26
|
+
error: 'test',
|
|
27
|
+
}
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
test('sets the kind', ({ assert }) => {
|
|
31
|
+
const init: IErrorResponse = { ...base }
|
|
32
|
+
const response = new ErrorResponse(init)
|
|
33
|
+
assert.equal(response.kind, HttpResponseKind)
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
test('sets the status', ({ assert }) => {
|
|
37
|
+
const init: IErrorResponse = { ...base, ...{ status: 200 } }
|
|
38
|
+
const response = new ErrorResponse(init)
|
|
39
|
+
assert.equal(response.status, 200)
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
test('sets the error', ({ assert }) => {
|
|
43
|
+
const init: IErrorResponse = { ...base }
|
|
44
|
+
const response = new ErrorResponse(init)
|
|
45
|
+
assert.equal(response.error.message, 'test')
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
test('sets the parent properties', ({ assert }) => {
|
|
49
|
+
const init: IErrorResponse = {
|
|
50
|
+
...base,
|
|
51
|
+
...{
|
|
52
|
+
status: 200,
|
|
53
|
+
statusText: 'hello',
|
|
54
|
+
headers: 'content-type: test',
|
|
55
|
+
payload: 'test',
|
|
56
|
+
},
|
|
57
|
+
}
|
|
58
|
+
const response = new ErrorResponse(JSON.stringify(init))
|
|
59
|
+
assert.equal(response.status, 200, 'has the status')
|
|
60
|
+
assert.equal(response.statusText, 'hello', 'has the statusText')
|
|
61
|
+
assert.equal(response.headers, 'content-type: test', 'has the headers')
|
|
62
|
+
assert.equal(response.payload, 'test', 'has the payload')
|
|
63
|
+
})
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
test.group('toJSON()', () => {
|
|
67
|
+
test('serializes the kind', ({ assert }) => {
|
|
68
|
+
const response = new ErrorResponse()
|
|
69
|
+
const result = response.toJSON()
|
|
70
|
+
assert.equal(result.kind, HttpResponseKind)
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
test('serializes the error', ({ assert }) => {
|
|
74
|
+
const response = ErrorResponse.fromError('test')
|
|
75
|
+
const result = response.toJSON()
|
|
76
|
+
assert.equal((result.error as ISerializedError).message, 'test')
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
test('serializes the parent values', ({ assert }) => {
|
|
80
|
+
const init: IErrorResponse = {
|
|
81
|
+
status: 200,
|
|
82
|
+
statusText: 'hello',
|
|
83
|
+
headers: 'content-type: test',
|
|
84
|
+
payload: 'test',
|
|
85
|
+
error: 'test',
|
|
86
|
+
}
|
|
87
|
+
const response = new ErrorResponse(init)
|
|
88
|
+
const result = response.toJSON()
|
|
89
|
+
assert.equal(result.status, 200)
|
|
90
|
+
assert.equal(result.statusText, 'hello')
|
|
91
|
+
})
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
test.group('ErrorResponse.isErrorResponse()', () => {
|
|
95
|
+
test('returns true when is an error response', ({ assert }) => {
|
|
96
|
+
const response = ErrorResponse.fromError('test')
|
|
97
|
+
assert.isTrue(ErrorResponse.isErrorResponse(response.toJSON()))
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
test('returns false otherwise', ({ assert }) => {
|
|
101
|
+
const response = HttpResponse.fromValues(200)
|
|
102
|
+
assert.isFalse(ErrorResponse.isErrorResponse(response.toJSON()))
|
|
103
|
+
})
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
test.group('ErrorResponse.fromLegacy()', () => {
|
|
107
|
+
test('sets the kind', async ({ assert }) => {
|
|
108
|
+
const init: LegacyErrorResponse = {
|
|
109
|
+
error: new Error('test'),
|
|
110
|
+
status: 200,
|
|
111
|
+
}
|
|
112
|
+
const response = await ErrorResponse.fromLegacy(init)
|
|
113
|
+
assert.equal(response.kind, HttpResponseKind)
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
test('sets the status', async ({ assert }) => {
|
|
117
|
+
const init: LegacyErrorResponse = {
|
|
118
|
+
error: new Error('test'),
|
|
119
|
+
status: 200,
|
|
120
|
+
}
|
|
121
|
+
const response = await ErrorResponse.fromLegacy(init)
|
|
122
|
+
assert.equal(response.status, 200)
|
|
123
|
+
})
|
|
124
|
+
|
|
125
|
+
test('sets the default status', async ({ assert }) => {
|
|
126
|
+
const init: LegacyErrorResponse = {
|
|
127
|
+
error: new Error('test'),
|
|
128
|
+
// @ts-expect-error Used in testing
|
|
129
|
+
status: undefined,
|
|
130
|
+
}
|
|
131
|
+
const response = await ErrorResponse.fromLegacy(init)
|
|
132
|
+
assert.equal(response.status, 0)
|
|
133
|
+
})
|
|
134
|
+
|
|
135
|
+
test('sets the error', async ({ assert }) => {
|
|
136
|
+
const init: LegacyErrorResponse = {
|
|
137
|
+
error: new Error('test'),
|
|
138
|
+
status: 200,
|
|
139
|
+
}
|
|
140
|
+
const response = await ErrorResponse.fromLegacy(init)
|
|
141
|
+
assert.equal(response.error.message, 'test')
|
|
142
|
+
})
|
|
143
|
+
|
|
144
|
+
test('sets the default error', async ({ assert }) => {
|
|
145
|
+
const init: LegacyErrorResponse = {
|
|
146
|
+
// @ts-expect-error Used in testing
|
|
147
|
+
error: undefined,
|
|
148
|
+
status: 100,
|
|
149
|
+
}
|
|
150
|
+
const response = await ErrorResponse.fromLegacy(init)
|
|
151
|
+
assert.equal(response.error.message, 'Unknown error')
|
|
152
|
+
})
|
|
153
|
+
|
|
154
|
+
test('sets the headers', async ({ assert }) => {
|
|
155
|
+
const init: LegacyErrorResponse = {
|
|
156
|
+
error: new Error('test'),
|
|
157
|
+
status: 200,
|
|
158
|
+
headers: 'x-test: true',
|
|
159
|
+
}
|
|
160
|
+
const response = await ErrorResponse.fromLegacy(init)
|
|
161
|
+
assert.equal(response.headers, 'x-test: true')
|
|
162
|
+
})
|
|
163
|
+
|
|
164
|
+
test('sets the statusText', async ({ assert }) => {
|
|
165
|
+
const init: LegacyErrorResponse = {
|
|
166
|
+
error: new Error('test'),
|
|
167
|
+
status: 200,
|
|
168
|
+
statusText: 'Super OK',
|
|
169
|
+
}
|
|
170
|
+
const response = await ErrorResponse.fromLegacy(init)
|
|
171
|
+
assert.equal(response.statusText, 'Super OK')
|
|
172
|
+
})
|
|
173
|
+
|
|
174
|
+
test('sets the payload from a string', async ({ assert }) => {
|
|
175
|
+
const init: LegacyErrorResponse = {
|
|
176
|
+
error: new Error('test'),
|
|
177
|
+
status: 200,
|
|
178
|
+
payload: 'I am an error',
|
|
179
|
+
}
|
|
180
|
+
const response = await ErrorResponse.fromLegacy(init)
|
|
181
|
+
assert.equal(response.payload, 'I am an error')
|
|
182
|
+
})
|
|
183
|
+
})
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { test } from '@japa/runner'
|
|
2
|
+
import { assert } from '@esm-bundle/chai'
|
|
3
|
+
import { Property } from '../../../src/models/Property.js'
|
|
4
|
+
import { HeadersArray } from '../../../src/models/HeadersArray.js'
|
|
5
|
+
import { Headers } from '../../../src/lib/headers/Headers.js'
|
|
6
|
+
|
|
7
|
+
test('HeadersArray.from() | initializes the array with the properties', () => {
|
|
8
|
+
const p1 = Property.String('a', 'b', true).toJSON()
|
|
9
|
+
const p2 = Property.String('c', 'd', false).toJSON()
|
|
10
|
+
const arr = HeadersArray.from([p1, p2])
|
|
11
|
+
assert.lengthOf(arr, 2, 'has 2 elements')
|
|
12
|
+
assert.equal(arr[0].name, 'a', 'has item #1 name')
|
|
13
|
+
assert.equal(arr[0].value, 'b', 'has item #1 value')
|
|
14
|
+
assert.equal(arr[0].enabled, true, 'has item #1 enabled')
|
|
15
|
+
assert.equal(arr[1].name, 'c', 'has item #2 name')
|
|
16
|
+
assert.equal(arr[1].value, 'd', 'has item #2 value')
|
|
17
|
+
assert.equal(arr[1].enabled, false, 'has item #2 enabled')
|
|
18
|
+
assert.instanceOf(arr[0], Property, 'items are instances of Property')
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
test('HeadersArray.from() | initializes the array from a set', () => {
|
|
22
|
+
const p1 = Property.String('a', 'b', true).toJSON()
|
|
23
|
+
const p2 = Property.String('c', 'd', false).toJSON()
|
|
24
|
+
const arr = HeadersArray.from([...new Set([p1, p2])])
|
|
25
|
+
assert.lengthOf(arr, 2, 'has 2 elements')
|
|
26
|
+
assert.instanceOf(arr[0], Property, 'items are instances of Property')
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
test('HeadersArray.fromHeaders() | initializes all items', () => {
|
|
30
|
+
const input = 'My_Test: header\n# disabled: value\nAbCd: Test'
|
|
31
|
+
const arr = HeadersArray.fromHeaders(input)
|
|
32
|
+
assert.lengthOf(arr, 3, 'has 3 elements')
|
|
33
|
+
assert.equal(arr[0].enabled, true, 'has item #1 enabled')
|
|
34
|
+
assert.equal(arr[1].enabled, false, 'has item #2 enabled')
|
|
35
|
+
assert.equal(arr[2].enabled, true, 'has item #3 enabled')
|
|
36
|
+
|
|
37
|
+
assert.equal(arr[0].type, 'string', 'has item #1 type')
|
|
38
|
+
assert.equal(arr[1].type, 'string', 'has item #2 type')
|
|
39
|
+
assert.equal(arr[2].type, 'string', 'has item #3 type')
|
|
40
|
+
|
|
41
|
+
assert.instanceOf(arr[0], Property, 'items are instances of Property')
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
test('HeadersArray#toString() | returns an HTTP string', () => {
|
|
45
|
+
const input = 'My_Test: header\nAbCd: Test'
|
|
46
|
+
const instance = HeadersArray.fromHeaders(input)
|
|
47
|
+
const result = instance.toString()
|
|
48
|
+
assert.equal(result, input)
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
test('HeadersArray#toString() | does not include disabled items', () => {
|
|
52
|
+
const input = 'My_Test: header\nAbCd: Test'
|
|
53
|
+
const str = 'My_Test: header\nAbCd: Test\n#disabled: value'
|
|
54
|
+
const instance = HeadersArray.fromHeaders(str)
|
|
55
|
+
const result = instance.toString()
|
|
56
|
+
assert.equal(result, input)
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
test('HeadersArray#toRawString() | returns an HTTP string', () => {
|
|
60
|
+
const input = 'My_Test: header\n# disabled: value\nAbCd: Test'
|
|
61
|
+
const instance = HeadersArray.fromHeaders(input)
|
|
62
|
+
const result = instance.toRawString()
|
|
63
|
+
assert.equal(result, input)
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
test('HeadersArray#toHeaders() | returns an instance of headers', () => {
|
|
67
|
+
const input = 'My_Test: header\n# disabled: value\nAbCd: Test'
|
|
68
|
+
const instance = HeadersArray.fromHeaders(input)
|
|
69
|
+
const result = instance.toHeaders()
|
|
70
|
+
assert.instanceOf(result, Headers, 'is the instance of headers')
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
test('HeadersArray#toHeaders() | has enabled properties', () => {
|
|
74
|
+
const input = 'My_Test: header\n# disabled: value\nAbCd: Test'
|
|
75
|
+
const instance = HeadersArray.fromHeaders(input)
|
|
76
|
+
const result = instance.toHeaders()
|
|
77
|
+
assert.equal(result.get('My_Test'), 'header')
|
|
78
|
+
assert.equal(result.get('AbCd'), 'Test')
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
test('HeadersArray#toHeaders() | has disabled properties', () => {
|
|
82
|
+
const input = 'My_Test: header\n# disabled: value\nAbCd: Test'
|
|
83
|
+
const instance = HeadersArray.fromHeaders(input)
|
|
84
|
+
const result = instance.toHeaders()
|
|
85
|
+
assert.equal(result._map['disabled'].value, 'value')
|
|
86
|
+
})
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { test } from '@japa/runner'
|
|
2
|
+
import { assert } from '@esm-bundle/chai'
|
|
3
|
+
import {
|
|
4
|
+
EqualAssertion,
|
|
5
|
+
EqualAssertionKind,
|
|
6
|
+
} from '../../../../../src/models/http-flows/steps/assertion/EqualAssertion.js'
|
|
7
|
+
|
|
8
|
+
test.group('EqualAssertion constructor()', () => {
|
|
9
|
+
test('initializes from values', () => {
|
|
10
|
+
const instance = new EqualAssertion('a', true, 'http://www.w3.org/2001/XMLSchema#string')
|
|
11
|
+
assert.equal(instance.value, 'a')
|
|
12
|
+
assert.equal(instance.dataType, 'http://www.w3.org/2001/XMLSchema#string')
|
|
13
|
+
assert.isTrue(instance.strict)
|
|
14
|
+
assert.isTrue(instance.enabled)
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
test('ignores not set values', () => {
|
|
18
|
+
const instance = new EqualAssertion('a')
|
|
19
|
+
assert.equal(instance.value, 'a')
|
|
20
|
+
assert.isUndefined(instance.dataType)
|
|
21
|
+
assert.isUndefined(instance.strict)
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
test('initializes from the schema', () => {
|
|
25
|
+
const instance = new EqualAssertion({
|
|
26
|
+
kind: EqualAssertionKind,
|
|
27
|
+
value: 'a',
|
|
28
|
+
strict: false,
|
|
29
|
+
dataType: 'http://www.w3.org/2001/XMLSchema#boolean',
|
|
30
|
+
enabled: false,
|
|
31
|
+
})
|
|
32
|
+
assert.equal(instance.value, 'a')
|
|
33
|
+
assert.equal(instance.dataType, 'http://www.w3.org/2001/XMLSchema#boolean')
|
|
34
|
+
assert.isFalse(instance.strict)
|
|
35
|
+
assert.isFalse(instance.enabled)
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
test('initializes empty class', () => {
|
|
39
|
+
const instance = new EqualAssertion()
|
|
40
|
+
assert.equal(instance.kind, EqualAssertionKind)
|
|
41
|
+
assert.isUndefined(instance.enabled)
|
|
42
|
+
})
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
test.group('EqualAssertion checkValidity()', () => {
|
|
46
|
+
test('returns true when has the value', () => {
|
|
47
|
+
const instance = new EqualAssertion('a', true, 'http://www.w3.org/2001/XMLSchema#string')
|
|
48
|
+
assert.isTrue(instance.checkValidity())
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
test('returns false when has no value', () => {
|
|
52
|
+
const instance = new EqualAssertion()
|
|
53
|
+
assert.isFalse(instance.checkValidity())
|
|
54
|
+
})
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
test.group('EqualAssertion toJSON()', () => {
|
|
58
|
+
test('serializes the kind', () => {
|
|
59
|
+
const instance = new EqualAssertion('a', true, 'http://www.w3.org/2001/XMLSchema#string')
|
|
60
|
+
assert.equal(instance.kind, EqualAssertionKind)
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
test('serializes the value when set', () => {
|
|
64
|
+
const instance = new EqualAssertion('a', true, 'http://www.w3.org/2001/XMLSchema#string')
|
|
65
|
+
assert.equal(instance.value, 'a')
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
test('ignores the value when not set', () => {
|
|
69
|
+
const instance = new EqualAssertion()
|
|
70
|
+
assert.isUndefined(instance.value)
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
test('serializes the dataType when set', () => {
|
|
74
|
+
const instance = new EqualAssertion('a', true, 'http://www.w3.org/2001/XMLSchema#string')
|
|
75
|
+
assert.equal(instance.dataType, 'http://www.w3.org/2001/XMLSchema#string')
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
test('ignores the dataType when not set', () => {
|
|
79
|
+
const instance = new EqualAssertion()
|
|
80
|
+
assert.isUndefined(instance.dataType)
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
test('serializes the strict when set', () => {
|
|
84
|
+
const instance = new EqualAssertion('a', true, 'http://www.w3.org/2001/XMLSchema#string')
|
|
85
|
+
assert.isTrue(instance.strict)
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
test('ignores the strict when not set', () => {
|
|
89
|
+
const instance = new EqualAssertion()
|
|
90
|
+
assert.isUndefined(instance.strict)
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
test('serializes the enabled when set', () => {
|
|
94
|
+
const instance = new EqualAssertion('a', true, 'http://www.w3.org/2001/XMLSchema#string')
|
|
95
|
+
instance.enabled = true
|
|
96
|
+
assert.isTrue(instance.enabled)
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
test('ignores the enabled when not set', () => {
|
|
100
|
+
const instance = new EqualAssertion()
|
|
101
|
+
assert.isUndefined(instance.enabled)
|
|
102
|
+
})
|
|
103
|
+
})
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { test } from '@japa/runner'
|
|
2
|
+
import { assert } from '@esm-bundle/chai'
|
|
3
|
+
import {
|
|
4
|
+
GreaterThanAssertion,
|
|
5
|
+
GreaterThanAssertionKind,
|
|
6
|
+
} from '../../../../../src/models/http-flows/steps/assertion/GreaterThanAssertion.js'
|
|
7
|
+
|
|
8
|
+
test.group('GreaterThanAssertion constructor()', () => {
|
|
9
|
+
test('initializes from values', () => {
|
|
10
|
+
const instance = new GreaterThanAssertion(10, true)
|
|
11
|
+
assert.equal(instance.value, 10)
|
|
12
|
+
assert.isTrue(instance.equal)
|
|
13
|
+
assert.isTrue(instance.enabled)
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
test('ignores not set values', () => {
|
|
17
|
+
const instance = new GreaterThanAssertion(5)
|
|
18
|
+
assert.equal(instance.value, 5)
|
|
19
|
+
assert.isUndefined(instance.equal)
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
test('initializes from the schema', () => {
|
|
23
|
+
const instance = new GreaterThanAssertion({
|
|
24
|
+
kind: GreaterThanAssertionKind,
|
|
25
|
+
value: 5,
|
|
26
|
+
equal: false,
|
|
27
|
+
enabled: false,
|
|
28
|
+
})
|
|
29
|
+
assert.equal(instance.value, 5)
|
|
30
|
+
assert.isFalse(instance.equal)
|
|
31
|
+
assert.isFalse(instance.enabled)
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
test('initializes empty class', () => {
|
|
35
|
+
const instance = new GreaterThanAssertion()
|
|
36
|
+
assert.equal(instance.kind, GreaterThanAssertionKind)
|
|
37
|
+
assert.isUndefined(instance.enabled)
|
|
38
|
+
assert.isUndefined(instance.value)
|
|
39
|
+
assert.isUndefined(instance.equal)
|
|
40
|
+
})
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
test.group('GreaterThanAssertion checkValidity()', () => {
|
|
44
|
+
test('returns true when has the value', () => {
|
|
45
|
+
const instance = new GreaterThanAssertion(10, true)
|
|
46
|
+
assert.isTrue(instance.checkValidity())
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
test('returns false when has no value', () => {
|
|
50
|
+
const instance = new GreaterThanAssertion()
|
|
51
|
+
assert.isFalse(instance.checkValidity())
|
|
52
|
+
})
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
test.group('GreaterThanAssertion toJSON()', () => {
|
|
56
|
+
test('serializes the kind', () => {
|
|
57
|
+
const instance = new GreaterThanAssertion(10, true)
|
|
58
|
+
assert.equal(instance.kind, GreaterThanAssertionKind)
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
test('serializes the value when set', () => {
|
|
62
|
+
const instance = new GreaterThanAssertion(10, true)
|
|
63
|
+
assert.equal(instance.value, 10)
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
test('ignores the value when not set', () => {
|
|
67
|
+
const instance = new GreaterThanAssertion()
|
|
68
|
+
assert.isUndefined(instance.value)
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
test('serializes the equal when set', () => {
|
|
72
|
+
const instance = new GreaterThanAssertion(10, true)
|
|
73
|
+
assert.isTrue(instance.equal)
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
test('ignores the strict when not set', () => {
|
|
77
|
+
const instance = new GreaterThanAssertion()
|
|
78
|
+
assert.isUndefined(instance.equal)
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
test('serializes the enabled when set', () => {
|
|
82
|
+
const instance = new GreaterThanAssertion(10, true)
|
|
83
|
+
instance.enabled = true
|
|
84
|
+
assert.isTrue(instance.enabled)
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
test('ignores the enabled when not set', () => {
|
|
88
|
+
const instance = new GreaterThanAssertion()
|
|
89
|
+
assert.isUndefined(instance.enabled)
|
|
90
|
+
})
|
|
91
|
+
})
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { test } from '@japa/runner'
|
|
2
|
+
import { assert } from '@esm-bundle/chai'
|
|
3
|
+
import {
|
|
4
|
+
IncludesAssertion,
|
|
5
|
+
IncludesAssertionKind,
|
|
6
|
+
} from '../../../../../src/models/http-flows/steps/assertion/IncludesAssertion.js'
|
|
7
|
+
|
|
8
|
+
test.group('IncludesAssertion constructor()', () => {
|
|
9
|
+
test('initializes from values', () => {
|
|
10
|
+
const instance = new IncludesAssertion('test-value')
|
|
11
|
+
assert.equal(instance.value, 'test-value')
|
|
12
|
+
assert.isTrue(instance.enabled)
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
test('initializes from the schema', () => {
|
|
16
|
+
const instance = new IncludesAssertion({
|
|
17
|
+
kind: IncludesAssertionKind,
|
|
18
|
+
value: 'test-value',
|
|
19
|
+
enabled: false,
|
|
20
|
+
})
|
|
21
|
+
assert.equal(instance.value, 'test-value')
|
|
22
|
+
assert.isFalse(instance.enabled)
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
test('initializes empty class', () => {
|
|
26
|
+
const instance = new IncludesAssertion()
|
|
27
|
+
assert.equal(instance.kind, IncludesAssertionKind)
|
|
28
|
+
assert.isUndefined(instance.enabled)
|
|
29
|
+
assert.isUndefined(instance.value)
|
|
30
|
+
})
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
test.group('IncludesAssertion checkValidity()', () => {
|
|
34
|
+
test('returns true when has the value', () => {
|
|
35
|
+
const instance = new IncludesAssertion('test-value')
|
|
36
|
+
assert.isTrue(instance.checkValidity())
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
test('returns false when has no value', () => {
|
|
40
|
+
const instance = new IncludesAssertion()
|
|
41
|
+
assert.isFalse(instance.checkValidity())
|
|
42
|
+
})
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
test.group('IncludesAssertion toJSON()', () => {
|
|
46
|
+
test('serializes the kind', () => {
|
|
47
|
+
const instance = new IncludesAssertion('test-value')
|
|
48
|
+
assert.equal(instance.kind, IncludesAssertionKind)
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
test('serializes the value when set', () => {
|
|
52
|
+
const instance = new IncludesAssertion('test-value')
|
|
53
|
+
assert.equal(instance.value, 'test-value')
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
test('ignores the value when not set', () => {
|
|
57
|
+
const instance = new IncludesAssertion()
|
|
58
|
+
assert.isUndefined(instance.value)
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
test('serializes the enabled when set', () => {
|
|
62
|
+
const instance = new IncludesAssertion('test-value')
|
|
63
|
+
instance.enabled = true
|
|
64
|
+
assert.isTrue(instance.enabled)
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
test('ignores the enabled when not set', () => {
|
|
68
|
+
const instance = new IncludesAssertion()
|
|
69
|
+
assert.isUndefined(instance.enabled)
|
|
70
|
+
})
|
|
71
|
+
})
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { test } from '@japa/runner'
|
|
2
|
+
import { assert } from '@esm-bundle/chai'
|
|
3
|
+
import {
|
|
4
|
+
LessThanAssertion,
|
|
5
|
+
LessThanAssertionKind,
|
|
6
|
+
} from '../../../../../src/models/http-flows/steps/assertion/LessThanAssertion.js'
|
|
7
|
+
|
|
8
|
+
test.group('LessThanAssertion constructor()', () => {
|
|
9
|
+
test('initializes from values', () => {
|
|
10
|
+
const instance = new LessThanAssertion(10, true)
|
|
11
|
+
assert.equal(instance.value, 10)
|
|
12
|
+
assert.isTrue(instance.equal)
|
|
13
|
+
assert.isTrue(instance.enabled)
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
test('ignores not set values', () => {
|
|
17
|
+
const instance = new LessThanAssertion(5)
|
|
18
|
+
assert.equal(instance.value, 5)
|
|
19
|
+
assert.isUndefined(instance.equal)
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
test('initializes from the schema', () => {
|
|
23
|
+
const instance = new LessThanAssertion({
|
|
24
|
+
kind: LessThanAssertionKind,
|
|
25
|
+
value: 5,
|
|
26
|
+
equal: false,
|
|
27
|
+
enabled: false,
|
|
28
|
+
})
|
|
29
|
+
assert.equal(instance.value, 5)
|
|
30
|
+
assert.isFalse(instance.equal)
|
|
31
|
+
assert.isFalse(instance.enabled)
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
test('initializes empty class', () => {
|
|
35
|
+
const instance = new LessThanAssertion()
|
|
36
|
+
assert.equal(instance.kind, LessThanAssertionKind)
|
|
37
|
+
assert.isUndefined(instance.enabled)
|
|
38
|
+
assert.isUndefined(instance.value)
|
|
39
|
+
assert.isUndefined(instance.equal)
|
|
40
|
+
})
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
test.group('LessThanAssertion checkValidity()', () => {
|
|
44
|
+
test('returns true when has the value', () => {
|
|
45
|
+
const instance = new LessThanAssertion(10, true)
|
|
46
|
+
assert.isTrue(instance.checkValidity())
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
test('returns false when has no value', () => {
|
|
50
|
+
const instance = new LessThanAssertion()
|
|
51
|
+
assert.isFalse(instance.checkValidity())
|
|
52
|
+
})
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
test.group('LessThanAssertion toJSON()', () => {
|
|
56
|
+
test('serializes the kind', () => {
|
|
57
|
+
const instance = new LessThanAssertion(10, true)
|
|
58
|
+
assert.equal(instance.kind, LessThanAssertionKind)
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
test('serializes the value when set', () => {
|
|
62
|
+
const instance = new LessThanAssertion(10, true)
|
|
63
|
+
assert.equal(instance.value, 10)
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
test('ignores the value when not set', () => {
|
|
67
|
+
const instance = new LessThanAssertion()
|
|
68
|
+
assert.isUndefined(instance.value)
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
test('serializes the equal when set', () => {
|
|
72
|
+
const instance = new LessThanAssertion(10, true)
|
|
73
|
+
assert.isTrue(instance.equal)
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
test('ignores the strict when not set', () => {
|
|
77
|
+
const instance = new LessThanAssertion()
|
|
78
|
+
assert.isUndefined(instance.equal)
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
test('serializes the enabled when set', () => {
|
|
82
|
+
const instance = new LessThanAssertion(10, true)
|
|
83
|
+
instance.enabled = true
|
|
84
|
+
assert.isTrue(instance.enabled)
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
test('ignores the enabled when not set', () => {
|
|
88
|
+
const instance = new LessThanAssertion()
|
|
89
|
+
assert.isUndefined(instance.enabled)
|
|
90
|
+
})
|
|
91
|
+
})
|