Skip to content

Commit 3054a86

Browse files
authored
feat: move to tap 15 (#313)
* feat: move to tap15 * fix: deprecated methods
1 parent d7e724c commit 3054a86

19 files changed

+143
-144
lines changed

.taprc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
esm: false
21
ts: false
32
jsx: false
43
coverage: false

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"proxyquire": "^2.1.3",
4141
"semver": "^7.1.0",
4242
"standard": "^16.0.1",
43-
"tap": "^14.0.0",
43+
"tap": "^15.0.0",
4444
"typescript": "^4.0.2"
4545
},
4646
"dependencies": {

test/allof.test.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,23 +44,23 @@ test('object with allOf and multiple schema on the allOf', (t) => {
4444
id: 1
4545
})
4646
} catch (e) {
47-
t.is(e.message, '"name" is required!')
47+
t.equal(e.message, '"name" is required!')
4848
}
4949

5050
try {
5151
stringify({
5252
name: 'string'
5353
})
5454
} catch (e) {
55-
t.is(e.message, '"id" is required!')
55+
t.equal(e.message, '"id" is required!')
5656
}
5757

58-
t.is(stringify({
58+
t.equal(stringify({
5959
id: 1,
6060
name: 'string'
6161
}), '{"name":"string","id":1}')
6262

63-
t.is(stringify({
63+
t.equal(stringify({
6464
id: 1,
6565
name: 'string',
6666
tag: 'otherString'
@@ -92,7 +92,7 @@ test('object with allOf and one schema on the allOf', (t) => {
9292
const value = stringify({
9393
id: 1
9494
})
95-
t.is(value, '{"id":1}')
95+
t.equal(value, '{"id":1}')
9696
})
9797

9898
test('object with allOf and no schema on the allOf', (t) => {
@@ -108,7 +108,7 @@ test('object with allOf and no schema on the allOf', (t) => {
108108
build(schema)
109109
t.fail()
110110
} catch (e) {
111-
t.is(e.message, 'schema is invalid: data.allOf should NOT have fewer than 1 items')
111+
t.equal(e.message, 'schema is invalid: data.allOf should NOT have fewer than 1 items')
112112
}
113113
})
114114

@@ -160,7 +160,7 @@ test('object with nested allOfs', (t) => {
160160
id3: 3,
161161
id4: 4 // extra prop shouldn't be in result
162162
})
163-
t.is(value, '{"id1":1,"id2":2,"id3":3}')
163+
t.equal(value, '{"id1":1,"id2":2,"id3":3}')
164164
})
165165

166166
test('object with $ref in allOf', (t) => {
@@ -191,7 +191,7 @@ test('object with $ref in allOf', (t) => {
191191
id1: 1,
192192
id2: 2 // extra prop shouldn't be in result
193193
})
194-
t.is(value, '{"id1":1}')
194+
t.equal(value, '{"id1":1}')
195195
})
196196

197197
test('object with $ref and other object in allOf', (t) => {
@@ -231,7 +231,7 @@ test('object with $ref and other object in allOf', (t) => {
231231
id2: 2,
232232
id3: 3 // extra prop shouldn't be in result
233233
})
234-
t.is(value, '{"id1":1,"id2":2}')
234+
t.equal(value, '{"id1":1,"id2":2}')
235235
})
236236

237237
test('object with multiple $refs in allOf', (t) => {
@@ -274,7 +274,7 @@ test('object with multiple $refs in allOf', (t) => {
274274
id2: 2,
275275
id3: 3 // extra prop shouldn't be in result
276276
})
277-
t.is(value, '{"id1":1,"id2":2}')
277+
t.equal(value, '{"id1":1,"id2":2}')
278278
})
279279

280280
test('object with external $refs in allOf', (t) => {
@@ -325,5 +325,5 @@ test('object with external $refs in allOf', (t) => {
325325
id2: 2,
326326
id3: 3 // extra prop shouldn't be in result
327327
})
328-
t.is(value, '{"id1":1,"id2":2}')
328+
t.equal(value, '{"id1":1,"id2":2}')
329329
})

test/any.test.js

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,19 @@ test('object with nested random property', (t) => {
1616
}
1717
const stringify = build(schema)
1818

19-
t.is(stringify({
19+
t.equal(stringify({
2020
id: 1, name: 'string'
2121
}), '{"id":1,"name":"string"}')
2222

23-
t.is(stringify({
23+
t.equal(stringify({
2424
id: 1, name: { first: 'name', last: 'last' }
2525
}), '{"id":1,"name":{"first":"name","last":"last"}}')
2626

27-
t.is(stringify({
27+
t.equal(stringify({
2828
id: 1, name: null
2929
}), '{"id":1,"name":null}')
3030

31-
t.is(stringify({
31+
t.equal(stringify({
3232
id: 1, name: ['first', 'last']
3333
}), '{"id":1,"name":["first","last"]}')
3434
})
@@ -45,7 +45,7 @@ test('object with empty schema with $id: undefined set', (t) => {
4545
}
4646
}
4747
const stringify = build(schema)
48-
t.is(stringify({
48+
t.equal(stringify({
4949
name: 'string'
5050
}), '{"name":"string"}')
5151
})
@@ -61,7 +61,7 @@ test('array with random items', (t) => {
6161
const stringify = build(schema)
6262

6363
const value = stringify([1, 'string', null])
64-
t.is(value, '[1,"string",null]')
64+
t.equal(value, '[1,"string",null]')
6565
})
6666

6767
test('empty schema', (t) => {
@@ -71,13 +71,13 @@ test('empty schema', (t) => {
7171

7272
const stringify = build(schema)
7373

74-
t.is(stringify(null), 'null')
75-
t.is(stringify(1), '1')
76-
t.is(stringify(true), 'true')
77-
t.is(stringify('hello'), '"hello"')
78-
t.is(stringify({}), '{}')
79-
t.is(stringify({ x: 10 }), '{"x":10}')
80-
t.is(stringify([true, 1, 'hello']), '[true,1,"hello"]')
74+
t.equal(stringify(null), 'null')
75+
t.equal(stringify(1), '1')
76+
t.equal(stringify(true), 'true')
77+
t.equal(stringify('hello'), '"hello"')
78+
t.equal(stringify({}), '{}')
79+
t.equal(stringify({ x: 10 }), '{"x":10}')
80+
t.equal(stringify([true, 1, 'hello']), '[true,1,"hello"]')
8181
})
8282

8383
test('empty schema on nested object', (t) => {
@@ -92,13 +92,13 @@ test('empty schema on nested object', (t) => {
9292

9393
const stringify = build(schema)
9494

95-
t.is(stringify({ x: null }), '{"x":null}')
96-
t.is(stringify({ x: 1 }), '{"x":1}')
97-
t.is(stringify({ x: true }), '{"x":true}')
98-
t.is(stringify({ x: 'hello' }), '{"x":"hello"}')
99-
t.is(stringify({ x: {} }), '{"x":{}}')
100-
t.is(stringify({ x: { x: 10 } }), '{"x":{"x":10}}')
101-
t.is(stringify({ x: [true, 1, 'hello'] }), '{"x":[true,1,"hello"]}')
95+
t.equal(stringify({ x: null }), '{"x":null}')
96+
t.equal(stringify({ x: 1 }), '{"x":1}')
97+
t.equal(stringify({ x: true }), '{"x":true}')
98+
t.equal(stringify({ x: 'hello' }), '{"x":"hello"}')
99+
t.equal(stringify({ x: {} }), '{"x":{}}')
100+
t.equal(stringify({ x: { x: 10 } }), '{"x":{"x":10}}')
101+
t.equal(stringify({ x: [true, 1, 'hello'] }), '{"x":[true,1,"hello"]}')
102102
})
103103

104104
test('empty schema on array', (t) => {
@@ -111,7 +111,7 @@ test('empty schema on array', (t) => {
111111

112112
const stringify = build(schema)
113113

114-
t.is(stringify([1, true, 'hello', [], { x: 1 }]), '[1,true,"hello",[],{"x":1}]')
114+
t.equal(stringify([1, true, 'hello', [], { x: 1 }]), '[1,true,"hello",[],{"x":1}]')
115115
})
116116

117117
test('empty schema on anyOf', (t) => {
@@ -147,8 +147,8 @@ test('empty schema on anyOf', (t) => {
147147

148148
const stringify = build(schema)
149149

150-
t.is(stringify({ kind: 'Bar', value: 1 }), '{"kind":"Bar","value":1}')
151-
t.is(stringify({ kind: 'Foo', value: 1 }), '{"kind":"Foo","value":1}')
152-
t.is(stringify({ kind: 'Foo', value: true }), '{"kind":"Foo","value":true}')
153-
t.is(stringify({ kind: 'Foo', value: 'hello' }), '{"kind":"Foo","value":"hello"}')
150+
t.equal(stringify({ kind: 'Bar', value: 1 }), '{"kind":"Bar","value":1}')
151+
t.equal(stringify({ kind: 'Foo', value: 1 }), '{"kind":"Foo","value":1}')
152+
t.equal(stringify({ kind: 'Foo', value: true }), '{"kind":"Foo","value":true}')
153+
t.equal(stringify({ kind: 'Foo', value: 'hello' }), '{"kind":"Foo","value":"hello"}')
154154
})

test/anyof.test.js

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ test('object with multiple types field', (t) => {
2121
}
2222
const stringify = build(schema)
2323

24-
t.is(stringify({
24+
t.equal(stringify({
2525
str: 'string'
2626
}), '{"str":"string"}')
2727

28-
t.is(stringify({
28+
t.equal(stringify({
2929
str: true
3030
}), '{"str":true}')
3131
})
@@ -53,11 +53,11 @@ test('object with field of type object or null', (t) => {
5353
}
5454
const stringify = build(schema)
5555

56-
t.is(stringify({
56+
t.equal(stringify({
5757
prop: null
5858
}), '{"prop":null}')
5959

60-
t.is(stringify({
60+
t.equal(stringify({
6161
prop: {
6262
str: 'string'
6363
}
@@ -87,13 +87,13 @@ test('object with field of type object or array', (t) => {
8787
}
8888
const stringify = build(schema)
8989

90-
t.is(stringify({
90+
t.equal(stringify({
9191
prop: {
9292
str: 'string'
9393
}
9494
}), '{"prop":{"str":"string"}}')
9595

96-
t.is(stringify({
96+
t.equal(stringify({
9797
prop: ['string']
9898
}), '{"prop":["string"]}')
9999
})
@@ -117,7 +117,7 @@ test('object with field of type string and coercion disable ', (t) => {
117117
const value = stringify({
118118
str: 1
119119
})
120-
t.is(value, '{"str":null}')
120+
t.equal(value, '{"str":null}')
121121
})
122122

123123
test('object with field of type string and coercion enable ', (t) => {
@@ -145,7 +145,7 @@ test('object with field of type string and coercion enable ', (t) => {
145145
const value = stringify({
146146
str: 1
147147
})
148-
t.is(value, '{"str":"1"}')
148+
t.equal(value, '{"str":"1"}')
149149
})
150150

151151
test('object with field with type union of multiple objects', (t) => {
@@ -179,9 +179,9 @@ test('object with field with type union of multiple objects', (t) => {
179179

180180
const stringify = build(schema)
181181

182-
t.is(stringify({ anyOfSchema: { baz: 5 } }), '{"anyOfSchema":{"baz":5}}')
182+
t.equal(stringify({ anyOfSchema: { baz: 5 } }), '{"anyOfSchema":{"baz":5}}')
183183

184-
t.is(stringify({ anyOfSchema: { bar: 'foo' } }), '{"anyOfSchema":{"bar":"foo"}}')
184+
t.equal(stringify({ anyOfSchema: { bar: 'foo' } }), '{"anyOfSchema":{"bar":"foo"}}')
185185
})
186186

187187
test('null value in schema', (t) => {
@@ -221,10 +221,10 @@ test('symbol value in schema', (t) => {
221221
}
222222

223223
const stringify = build(schema)
224-
t.is(stringify({ value: 'foo' }), '{"value":"foo"}')
225-
t.is(stringify({ value: 'bar' }), '{"value":"bar"}')
226-
t.is(stringify({ value: 'baz' }), '{"value":"baz"}')
227-
t.is(stringify({ value: 'qux' }), '{"value":null}')
224+
t.equal(stringify({ value: 'foo' }), '{"value":"foo"}')
225+
t.equal(stringify({ value: 'bar' }), '{"value":"bar"}')
226+
t.equal(stringify({ value: 'baz' }), '{"value":"baz"}')
227+
t.equal(stringify({ value: 'qux' }), '{"value":null}')
228228
})
229229

230230
test('anyOf and $ref together', (t) => {
@@ -253,9 +253,9 @@ test('anyOf and $ref together', (t) => {
253253

254254
const stringify = build(schema)
255255

256-
t.is(stringify({ cs: 'franco' }), '{"cs":"franco"}')
256+
t.equal(stringify({ cs: 'franco' }), '{"cs":"franco"}')
257257

258-
t.is(stringify({ cs: true }), '{"cs":true}')
258+
t.equal(stringify({ cs: true }), '{"cs":true}')
259259
})
260260

261261
test('anyOf and $ref: 2 levels are fine', (t) => {
@@ -291,7 +291,7 @@ test('anyOf and $ref: 2 levels are fine', (t) => {
291291

292292
const stringify = build(schema)
293293
const value = stringify({ cs: 3 })
294-
t.is(value, '{"cs":3}')
294+
t.equal(value, '{"cs":3}')
295295
})
296296

297297
test('anyOf and $ref: multiple levels should throw at build.', (t) => {
@@ -330,9 +330,9 @@ test('anyOf and $ref: multiple levels should throw at build.', (t) => {
330330

331331
const stringify = build(schema)
332332

333-
t.is(stringify({ cs: 3 }), '{"cs":3}')
334-
t.is(stringify({ cs: true }), '{"cs":true}')
335-
t.is(stringify({ cs: 'pippo' }), '{"cs":"pippo"}')
333+
t.equal(stringify({ cs: 3 }), '{"cs":3}')
334+
t.equal(stringify({ cs: true }), '{"cs":true}')
335+
t.equal(stringify({ cs: 'pippo' }), '{"cs":"pippo"}')
336336
})
337337

338338
test('anyOf and $ref - multiple external $ref', (t) => {
@@ -423,7 +423,7 @@ test('anyOf looks for all of the array items', (t) => {
423423
const stringify = build(schema)
424424

425425
const value = stringify([{ savedId: 'great' }, { error: 'oops' }])
426-
t.is(value, '[{"savedId":"great"},{"error":"oops"}]')
426+
t.equal(value, '[{"savedId":"great"},{"error":"oops"}]')
427427
})
428428

429429
test('anyOf with enum with more than 100 entries', (t) => {
@@ -445,5 +445,5 @@ test('anyOf with enum with more than 100 entries', (t) => {
445445
const stringify = build(schema)
446446

447447
const value = stringify(['EUR', 'USD', null])
448-
t.is(value, '["EUR","USD",null]')
448+
t.equal(value, '["EUR","USD",null]')
449449
})

test/array.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function buildTest (schema, toStringify) {
1313
const stringify = build(schema)
1414
const output = stringify(toStringify)
1515

16-
t.deepEqual(JSON.parse(output), toStringify)
16+
t.same(JSON.parse(output), toStringify)
1717
t.equal(output, JSON.stringify(toStringify))
1818
t.ok(validate(JSON.parse(output)), 'valid schema')
1919
})
@@ -195,7 +195,7 @@ test('moment array', (t) => {
195195
const value = stringify({
196196
times: [moment('2018-04-21T07:52:31.017Z')]
197197
})
198-
t.is(value, '{"times":["2018-04-21T07:52:31.017Z"]}')
198+
t.equal(value, '{"times":["2018-04-21T07:52:31.017Z"]}')
199199
})
200200

201201
buildTest({
@@ -254,5 +254,5 @@ test('object array with anyOf and symbol', (t) => {
254254
{ name: 'name-0', option: 'Foo' },
255255
{ name: 'name-1', option: 'Bar' }
256256
])
257-
t.is(value, '[{"name":"name-0","option":"Foo"},{"name":"name-1","option":"Bar"}]')
257+
t.equal(value, '[{"name":"name-0","option":"Foo"},{"name":"name-1","option":"Bar"}]')
258258
})

test/basic.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ function buildTest (schema, toStringify) {
1212
const stringify = build(schema)
1313
const output = stringify(toStringify)
1414

15-
t.deepEqual(JSON.parse(output), toStringify)
15+
t.same(JSON.parse(output), toStringify)
1616
t.equal(output, JSON.stringify(toStringify))
1717
t.ok(validate(JSON.parse(output)), 'valid schema')
1818
})
@@ -280,14 +280,14 @@ test('skip or coerce numbers and integers that are not numbers', (t) => {
280280
distance: 'long'
281281
})
282282

283-
t.deepEqual(JSON.parse(result), {})
283+
t.same(JSON.parse(result), {})
284284

285285
result = stringify({
286286
age: '42',
287287
distance: true
288288
})
289289

290-
t.deepEqual(JSON.parse(result), { age: 42, distance: 1 })
290+
t.same(JSON.parse(result), { age: 42, distance: 1 })
291291
t.end()
292292
})
293293

0 commit comments

Comments
 (0)