@dashevo/dpns-contract 1.0.0-dev.4 → 1.0.0-dev.6
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/.eslintrc +17 -14
- package/Cargo.toml +2 -2
- package/package.json +2 -2
- package/test/unit/dpnsContract.spec.js +211 -67
package/.eslintrc
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
2
|
+
"extends": "airbnb-base",
|
|
3
|
+
"rules": {
|
|
4
|
+
"no-plusplus": 0,
|
|
5
|
+
"eol-last": [
|
|
6
|
+
"error",
|
|
7
|
+
"always"
|
|
8
|
+
],
|
|
9
|
+
"class-methods-use-this": "off",
|
|
10
|
+
"curly": [
|
|
11
|
+
"error",
|
|
12
|
+
"all"
|
|
13
|
+
]
|
|
14
|
+
},
|
|
15
|
+
"globals": {
|
|
16
|
+
"BigInt": true
|
|
17
|
+
}
|
|
18
|
+
}
|
package/Cargo.toml
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dashevo/dpns-contract",
|
|
3
|
-
"version": "1.0.0-dev.
|
|
3
|
+
"version": "1.0.0-dev.6",
|
|
4
4
|
"description": "A contract and helper scripts for DPNS DApp",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"lint": "eslint .",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
],
|
|
32
32
|
"license": "MIT",
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@dashevo/wasm-dpp": "1.0.0-dev.
|
|
34
|
+
"@dashevo/wasm-dpp": "1.0.0-dev.6",
|
|
35
35
|
"chai": "^4.3.10",
|
|
36
36
|
"dirty-chai": "^2.0.1",
|
|
37
37
|
"eslint": "^8.53.0",
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
const crypto = require('crypto');
|
|
2
2
|
|
|
3
3
|
const {
|
|
4
|
-
DashPlatformProtocol,
|
|
4
|
+
DashPlatformProtocol,
|
|
5
|
+
JsonSchemaError,
|
|
5
6
|
} = require('@dashevo/wasm-dpp');
|
|
6
7
|
const generateRandomIdentifier = require('@dashevo/wasm-dpp/lib/test/utils/generateRandomIdentifierAsync');
|
|
7
8
|
|
|
@@ -10,10 +11,16 @@ const dpnsContractDocumentsSchema = require('../../schema/v1/dpns-contract-docum
|
|
|
10
11
|
|
|
11
12
|
const expectJsonSchemaError = (validationResult, errorCount = 1) => {
|
|
12
13
|
const errors = validationResult.getErrors();
|
|
13
|
-
expect(errors)
|
|
14
|
+
expect(errors)
|
|
15
|
+
.to
|
|
16
|
+
.have
|
|
17
|
+
.length(errorCount);
|
|
14
18
|
|
|
15
19
|
const error = validationResult.getErrors()[0];
|
|
16
|
-
expect(error)
|
|
20
|
+
expect(error)
|
|
21
|
+
.to
|
|
22
|
+
.be
|
|
23
|
+
.instanceof(JsonSchemaError);
|
|
17
24
|
|
|
18
25
|
return error;
|
|
19
26
|
};
|
|
@@ -30,11 +37,14 @@ describe('DPNS Contract', () => {
|
|
|
30
37
|
|
|
31
38
|
identityId = await generateRandomIdentifier();
|
|
32
39
|
|
|
33
|
-
dataContract = dpp.dataContract.create(identityId, dpnsContractDocumentsSchema);
|
|
40
|
+
dataContract = dpp.dataContract.create(identityId, BigInt(1), dpnsContractDocumentsSchema);
|
|
34
41
|
});
|
|
35
42
|
|
|
36
43
|
it('should have a valid contract definition', async () => {
|
|
37
|
-
expect(() => dpp.dataContract.create(identityId, dpnsContractDocumentsSchema))
|
|
44
|
+
expect(() => dpp.dataContract.create(identityId, BigInt(1), dpnsContractDocumentsSchema))
|
|
45
|
+
.to
|
|
46
|
+
.not
|
|
47
|
+
.throw();
|
|
38
48
|
});
|
|
39
49
|
|
|
40
50
|
describe('documents', () => {
|
|
@@ -55,8 +65,12 @@ describe('DPNS Contract', () => {
|
|
|
55
65
|
const validationResult = document.validate(dpp.protocolVersion);
|
|
56
66
|
const error = expectJsonSchemaError(validationResult);
|
|
57
67
|
|
|
58
|
-
expect(error.keyword)
|
|
59
|
-
|
|
68
|
+
expect(error.keyword)
|
|
69
|
+
.to
|
|
70
|
+
.equal('required');
|
|
71
|
+
expect(error.params.missingProperty)
|
|
72
|
+
.to
|
|
73
|
+
.equal('saltedDomainHash');
|
|
60
74
|
});
|
|
61
75
|
|
|
62
76
|
it('should not be empty', async () => {
|
|
@@ -66,8 +80,13 @@ describe('DPNS Contract', () => {
|
|
|
66
80
|
const validationResult = document.validate(dpp.protocolVersion);
|
|
67
81
|
const error = expectJsonSchemaError(validationResult);
|
|
68
82
|
|
|
69
|
-
expect(error.keyword)
|
|
70
|
-
|
|
83
|
+
expect(error.keyword)
|
|
84
|
+
.to
|
|
85
|
+
.equal('minItems');
|
|
86
|
+
expect(error.instancePath)
|
|
87
|
+
.to
|
|
88
|
+
.deep
|
|
89
|
+
.equal('/saltedDomainHash');
|
|
71
90
|
});
|
|
72
91
|
|
|
73
92
|
it('should be not less than 32 bytes', async () => {
|
|
@@ -77,8 +96,12 @@ describe('DPNS Contract', () => {
|
|
|
77
96
|
const validationResult = document.validate(dpp.protocolVersion);
|
|
78
97
|
const error = expectJsonSchemaError(validationResult);
|
|
79
98
|
|
|
80
|
-
expect(error.keyword)
|
|
81
|
-
|
|
99
|
+
expect(error.keyword)
|
|
100
|
+
.to
|
|
101
|
+
.equal('minItems');
|
|
102
|
+
expect(error.instancePath)
|
|
103
|
+
.to
|
|
104
|
+
.equal('/saltedDomainHash');
|
|
82
105
|
});
|
|
83
106
|
|
|
84
107
|
it('should be not longer than 32 bytes', async () => {
|
|
@@ -88,8 +111,12 @@ describe('DPNS Contract', () => {
|
|
|
88
111
|
const validationResult = document.validate(dpp.protocolVersion);
|
|
89
112
|
const error = expectJsonSchemaError(validationResult);
|
|
90
113
|
|
|
91
|
-
expect(error.keyword)
|
|
92
|
-
|
|
114
|
+
expect(error.keyword)
|
|
115
|
+
.to
|
|
116
|
+
.equal('maxItems');
|
|
117
|
+
expect(error.instancePath)
|
|
118
|
+
.to
|
|
119
|
+
.equal('/saltedDomainHash');
|
|
93
120
|
});
|
|
94
121
|
});
|
|
95
122
|
|
|
@@ -100,8 +127,13 @@ describe('DPNS Contract', () => {
|
|
|
100
127
|
const validationResult = document.validate(dpp.protocolVersion);
|
|
101
128
|
const error = expectJsonSchemaError(validationResult);
|
|
102
129
|
|
|
103
|
-
expect(error.keyword)
|
|
104
|
-
|
|
130
|
+
expect(error.keyword)
|
|
131
|
+
.to
|
|
132
|
+
.equal('additionalProperties');
|
|
133
|
+
expect(error.params.additionalProperties)
|
|
134
|
+
.to
|
|
135
|
+
.deep
|
|
136
|
+
.equal(['someOtherProperty']);
|
|
105
137
|
});
|
|
106
138
|
|
|
107
139
|
it('should be valid', async () => {
|
|
@@ -109,7 +141,10 @@ describe('DPNS Contract', () => {
|
|
|
109
141
|
|
|
110
142
|
const result = await preorder.validate(dpp.protocolVersion);
|
|
111
143
|
|
|
112
|
-
expect(result.isValid())
|
|
144
|
+
expect(result.isValid())
|
|
145
|
+
.to
|
|
146
|
+
.be
|
|
147
|
+
.true();
|
|
113
148
|
});
|
|
114
149
|
});
|
|
115
150
|
|
|
@@ -139,8 +174,12 @@ describe('DPNS Contract', () => {
|
|
|
139
174
|
const validationResult = document.validate(dpp.protocolVersion);
|
|
140
175
|
const error = expectJsonSchemaError(validationResult);
|
|
141
176
|
|
|
142
|
-
expect(error.keyword)
|
|
143
|
-
|
|
177
|
+
expect(error.keyword)
|
|
178
|
+
.to
|
|
179
|
+
.equal('required');
|
|
180
|
+
expect(error.params.missingProperty)
|
|
181
|
+
.to
|
|
182
|
+
.equal('label');
|
|
144
183
|
});
|
|
145
184
|
|
|
146
185
|
it('should follow pattern', async () => {
|
|
@@ -150,8 +189,12 @@ describe('DPNS Contract', () => {
|
|
|
150
189
|
const validationResult = document.validate(dpp.protocolVersion);
|
|
151
190
|
const error = expectJsonSchemaError(validationResult);
|
|
152
191
|
|
|
153
|
-
expect(error.keyword)
|
|
154
|
-
|
|
192
|
+
expect(error.keyword)
|
|
193
|
+
.to
|
|
194
|
+
.equal('pattern');
|
|
195
|
+
expect(error.instancePath)
|
|
196
|
+
.to
|
|
197
|
+
.equal('/label');
|
|
155
198
|
});
|
|
156
199
|
|
|
157
200
|
it('should be longer than 3 chars', async () => {
|
|
@@ -161,8 +204,12 @@ describe('DPNS Contract', () => {
|
|
|
161
204
|
const validationResult = document.validate(dpp.protocolVersion);
|
|
162
205
|
const error = expectJsonSchemaError(validationResult);
|
|
163
206
|
|
|
164
|
-
expect(error.keyword)
|
|
165
|
-
|
|
207
|
+
expect(error.keyword)
|
|
208
|
+
.to
|
|
209
|
+
.equal('minLength');
|
|
210
|
+
expect(error.instancePath)
|
|
211
|
+
.to
|
|
212
|
+
.equal('/label');
|
|
166
213
|
});
|
|
167
214
|
|
|
168
215
|
it('should be less than 63 chars', async () => {
|
|
@@ -172,8 +219,12 @@ describe('DPNS Contract', () => {
|
|
|
172
219
|
const validationResult = document.validate(dpp.protocolVersion);
|
|
173
220
|
const error = expectJsonSchemaError(validationResult, 2);
|
|
174
221
|
|
|
175
|
-
expect(error.keyword)
|
|
176
|
-
|
|
222
|
+
expect(error.keyword)
|
|
223
|
+
.to
|
|
224
|
+
.equal('pattern');
|
|
225
|
+
expect(error.instancePath)
|
|
226
|
+
.to
|
|
227
|
+
.equal('/label');
|
|
177
228
|
});
|
|
178
229
|
});
|
|
179
230
|
|
|
@@ -185,8 +236,12 @@ describe('DPNS Contract', () => {
|
|
|
185
236
|
const validationResult = document.validate(dpp.protocolVersion);
|
|
186
237
|
const error = expectJsonSchemaError(validationResult);
|
|
187
238
|
|
|
188
|
-
expect(error.keyword)
|
|
189
|
-
|
|
239
|
+
expect(error.keyword)
|
|
240
|
+
.to
|
|
241
|
+
.equal('required');
|
|
242
|
+
expect(error.params.missingProperty)
|
|
243
|
+
.to
|
|
244
|
+
.equal('normalizedLabel');
|
|
190
245
|
});
|
|
191
246
|
|
|
192
247
|
it('should follow pattern', async () => {
|
|
@@ -196,8 +251,12 @@ describe('DPNS Contract', () => {
|
|
|
196
251
|
const validationResult = document.validate(dpp.protocolVersion);
|
|
197
252
|
const error = expectJsonSchemaError(validationResult);
|
|
198
253
|
|
|
199
|
-
expect(error.keyword)
|
|
200
|
-
|
|
254
|
+
expect(error.keyword)
|
|
255
|
+
.to
|
|
256
|
+
.equal('pattern');
|
|
257
|
+
expect(error.instancePath)
|
|
258
|
+
.to
|
|
259
|
+
.equal('/normalizedLabel');
|
|
201
260
|
});
|
|
202
261
|
|
|
203
262
|
it('should be less than 63 chars', async () => {
|
|
@@ -207,8 +266,12 @@ describe('DPNS Contract', () => {
|
|
|
207
266
|
const validationResult = document.validate(dpp.protocolVersion);
|
|
208
267
|
const error = expectJsonSchemaError(validationResult, 2);
|
|
209
268
|
|
|
210
|
-
expect(error.keyword)
|
|
211
|
-
|
|
269
|
+
expect(error.keyword)
|
|
270
|
+
.to
|
|
271
|
+
.equal('pattern');
|
|
272
|
+
expect(error.instancePath)
|
|
273
|
+
.to
|
|
274
|
+
.equal('/normalizedLabel');
|
|
212
275
|
});
|
|
213
276
|
});
|
|
214
277
|
|
|
@@ -220,8 +283,12 @@ describe('DPNS Contract', () => {
|
|
|
220
283
|
const validationResult = document.validate(dpp.protocolVersion);
|
|
221
284
|
const error = expectJsonSchemaError(validationResult);
|
|
222
285
|
|
|
223
|
-
expect(error.keyword)
|
|
224
|
-
|
|
286
|
+
expect(error.keyword)
|
|
287
|
+
.to
|
|
288
|
+
.equal('required');
|
|
289
|
+
expect(error.params.missingProperty)
|
|
290
|
+
.to
|
|
291
|
+
.equal('normalizedParentDomainName');
|
|
225
292
|
});
|
|
226
293
|
|
|
227
294
|
it('should be less than 190 chars', async () => {
|
|
@@ -231,8 +298,12 @@ describe('DPNS Contract', () => {
|
|
|
231
298
|
const validationResult = document.validate(dpp.protocolVersion);
|
|
232
299
|
const error = expectJsonSchemaError(validationResult, 2);
|
|
233
300
|
|
|
234
|
-
expect(error.keyword)
|
|
235
|
-
|
|
301
|
+
expect(error.keyword)
|
|
302
|
+
.to
|
|
303
|
+
.equal('pattern');
|
|
304
|
+
expect(error.instancePath)
|
|
305
|
+
.to
|
|
306
|
+
.equal('/normalizedParentDomainName');
|
|
236
307
|
});
|
|
237
308
|
|
|
238
309
|
it('should follow pattern', async () => {
|
|
@@ -242,8 +313,12 @@ describe('DPNS Contract', () => {
|
|
|
242
313
|
const validationResult = document.validate(dpp.protocolVersion);
|
|
243
314
|
const error = expectJsonSchemaError(validationResult);
|
|
244
315
|
|
|
245
|
-
expect(error.keyword)
|
|
246
|
-
|
|
316
|
+
expect(error.keyword)
|
|
317
|
+
.to
|
|
318
|
+
.equal('pattern');
|
|
319
|
+
expect(error.instancePath)
|
|
320
|
+
.to
|
|
321
|
+
.equal('/normalizedParentDomainName');
|
|
247
322
|
});
|
|
248
323
|
});
|
|
249
324
|
|
|
@@ -255,8 +330,12 @@ describe('DPNS Contract', () => {
|
|
|
255
330
|
const validationResult = document.validate(dpp.protocolVersion);
|
|
256
331
|
const error = expectJsonSchemaError(validationResult);
|
|
257
332
|
|
|
258
|
-
expect(error.keyword)
|
|
259
|
-
|
|
333
|
+
expect(error.keyword)
|
|
334
|
+
.to
|
|
335
|
+
.equal('required');
|
|
336
|
+
expect(error.params.missingProperty)
|
|
337
|
+
.to
|
|
338
|
+
.equal('preorderSalt');
|
|
260
339
|
});
|
|
261
340
|
|
|
262
341
|
it('should not be empty', async () => {
|
|
@@ -267,8 +346,13 @@ describe('DPNS Contract', () => {
|
|
|
267
346
|
const validationResult = document.validate(dpp.protocolVersion);
|
|
268
347
|
const error = expectJsonSchemaError(validationResult);
|
|
269
348
|
|
|
270
|
-
expect(error.keyword)
|
|
271
|
-
|
|
349
|
+
expect(error.keyword)
|
|
350
|
+
.to
|
|
351
|
+
.equal('minItems');
|
|
352
|
+
expect(error.instancePath)
|
|
353
|
+
.to
|
|
354
|
+
.deep
|
|
355
|
+
.equal('/preorderSalt');
|
|
272
356
|
});
|
|
273
357
|
|
|
274
358
|
it('should be not less than 32 bytes', async () => {
|
|
@@ -278,8 +362,12 @@ describe('DPNS Contract', () => {
|
|
|
278
362
|
const validationResult = document.validate(dpp.protocolVersion);
|
|
279
363
|
const error = expectJsonSchemaError(validationResult);
|
|
280
364
|
|
|
281
|
-
expect(error.keyword)
|
|
282
|
-
|
|
365
|
+
expect(error.keyword)
|
|
366
|
+
.to
|
|
367
|
+
.equal('minItems');
|
|
368
|
+
expect(error.instancePath)
|
|
369
|
+
.to
|
|
370
|
+
.equal('/preorderSalt');
|
|
283
371
|
});
|
|
284
372
|
|
|
285
373
|
it('should be not longer than 32 bytes', async () => {
|
|
@@ -289,8 +377,12 @@ describe('DPNS Contract', () => {
|
|
|
289
377
|
const validationResult = document.validate(dpp.protocolVersion);
|
|
290
378
|
const error = expectJsonSchemaError(validationResult);
|
|
291
379
|
|
|
292
|
-
expect(error.keyword)
|
|
293
|
-
|
|
380
|
+
expect(error.keyword)
|
|
381
|
+
.to
|
|
382
|
+
.equal('maxItems');
|
|
383
|
+
expect(error.instancePath)
|
|
384
|
+
.to
|
|
385
|
+
.equal('/preorderSalt');
|
|
294
386
|
});
|
|
295
387
|
});
|
|
296
388
|
|
|
@@ -302,8 +394,13 @@ describe('DPNS Contract', () => {
|
|
|
302
394
|
const validationResult = document.validate(dpp.protocolVersion);
|
|
303
395
|
const error = expectJsonSchemaError(validationResult);
|
|
304
396
|
|
|
305
|
-
expect(error.keyword)
|
|
306
|
-
|
|
397
|
+
expect(error.keyword)
|
|
398
|
+
.to
|
|
399
|
+
.equal('additionalProperties');
|
|
400
|
+
expect(error.params.additionalProperties)
|
|
401
|
+
.to
|
|
402
|
+
.deep
|
|
403
|
+
.equal(['someOtherProperty']);
|
|
307
404
|
});
|
|
308
405
|
|
|
309
406
|
it('should be valid', async () => {
|
|
@@ -311,7 +408,10 @@ describe('DPNS Contract', () => {
|
|
|
311
408
|
|
|
312
409
|
const result = await domain.validate(dpp.protocolVersion);
|
|
313
410
|
|
|
314
|
-
expect(result.isValid())
|
|
411
|
+
expect(result.isValid())
|
|
412
|
+
.to
|
|
413
|
+
.be
|
|
414
|
+
.true();
|
|
315
415
|
});
|
|
316
416
|
|
|
317
417
|
describe('Records', () => {
|
|
@@ -322,8 +422,12 @@ describe('DPNS Contract', () => {
|
|
|
322
422
|
const validationResult = document.validate(dpp.protocolVersion);
|
|
323
423
|
const error = expectJsonSchemaError(validationResult);
|
|
324
424
|
|
|
325
|
-
expect(error.keyword)
|
|
326
|
-
|
|
425
|
+
expect(error.keyword)
|
|
426
|
+
.to
|
|
427
|
+
.equal('required');
|
|
428
|
+
expect(error.params.missingProperty)
|
|
429
|
+
.to
|
|
430
|
+
.equal('records');
|
|
327
431
|
});
|
|
328
432
|
|
|
329
433
|
it('should not be empty', async () => {
|
|
@@ -333,8 +437,13 @@ describe('DPNS Contract', () => {
|
|
|
333
437
|
const validationResult = document.validate(dpp.protocolVersion);
|
|
334
438
|
const error = expectJsonSchemaError(validationResult);
|
|
335
439
|
|
|
336
|
-
expect(error.keyword)
|
|
337
|
-
|
|
440
|
+
expect(error.keyword)
|
|
441
|
+
.to
|
|
442
|
+
.equal('minProperties');
|
|
443
|
+
expect(error.instancePath)
|
|
444
|
+
.to
|
|
445
|
+
.deep
|
|
446
|
+
.equal('/records');
|
|
338
447
|
});
|
|
339
448
|
|
|
340
449
|
it('should not have additional properties', async () => {
|
|
@@ -346,9 +455,16 @@ describe('DPNS Contract', () => {
|
|
|
346
455
|
const validationResult = document.validate(dpp.protocolVersion);
|
|
347
456
|
const error = expectJsonSchemaError(validationResult);
|
|
348
457
|
|
|
349
|
-
expect(error.keyword)
|
|
350
|
-
|
|
351
|
-
|
|
458
|
+
expect(error.keyword)
|
|
459
|
+
.to
|
|
460
|
+
.equal('additionalProperties');
|
|
461
|
+
expect(error.instancePath)
|
|
462
|
+
.to
|
|
463
|
+
.equal('/records');
|
|
464
|
+
expect(error.params.additionalProperties)
|
|
465
|
+
.to
|
|
466
|
+
.deep
|
|
467
|
+
.equal(['someOtherProperty']);
|
|
352
468
|
});
|
|
353
469
|
|
|
354
470
|
describe('Dash Identity', () => {
|
|
@@ -362,8 +478,12 @@ describe('DPNS Contract', () => {
|
|
|
362
478
|
const validationResult = document.validate(dpp.protocolVersion);
|
|
363
479
|
const error = expectJsonSchemaError(validationResult);
|
|
364
480
|
|
|
365
|
-
expect(error.keyword)
|
|
366
|
-
|
|
481
|
+
expect(error.keyword)
|
|
482
|
+
.to
|
|
483
|
+
.equal('maxProperties');
|
|
484
|
+
expect(error.instancePath)
|
|
485
|
+
.to
|
|
486
|
+
.equal('/records');
|
|
367
487
|
});
|
|
368
488
|
|
|
369
489
|
describe('dashUniqueIdentityId', () => {
|
|
@@ -374,7 +494,9 @@ describe('DPNS Contract', () => {
|
|
|
374
494
|
|
|
375
495
|
expect(() => {
|
|
376
496
|
dpp.document.create(dataContract, identityId, 'domain', rawDomainDocument);
|
|
377
|
-
})
|
|
497
|
+
})
|
|
498
|
+
.to
|
|
499
|
+
.throw();
|
|
378
500
|
});
|
|
379
501
|
|
|
380
502
|
it('should no more than 32 bytes', async () => {
|
|
@@ -384,7 +506,9 @@ describe('DPNS Contract', () => {
|
|
|
384
506
|
|
|
385
507
|
expect(() => {
|
|
386
508
|
dpp.document.create(dataContract, identityId, 'domain', rawDomainDocument);
|
|
387
|
-
})
|
|
509
|
+
})
|
|
510
|
+
.to
|
|
511
|
+
.throw();
|
|
388
512
|
});
|
|
389
513
|
});
|
|
390
514
|
|
|
@@ -396,7 +520,9 @@ describe('DPNS Contract', () => {
|
|
|
396
520
|
|
|
397
521
|
expect(() => {
|
|
398
522
|
dpp.document.create(dataContract, identityId, 'domain', rawDomainDocument);
|
|
399
|
-
})
|
|
523
|
+
})
|
|
524
|
+
.to
|
|
525
|
+
.throw();
|
|
400
526
|
});
|
|
401
527
|
|
|
402
528
|
it('should no more than 32 bytes', async () => {
|
|
@@ -406,7 +532,9 @@ describe('DPNS Contract', () => {
|
|
|
406
532
|
|
|
407
533
|
expect(() => {
|
|
408
534
|
dpp.document.create(dataContract, identityId, 'domain', rawDomainDocument);
|
|
409
|
-
})
|
|
535
|
+
})
|
|
536
|
+
.to
|
|
537
|
+
.throw();
|
|
410
538
|
});
|
|
411
539
|
});
|
|
412
540
|
});
|
|
@@ -420,8 +548,12 @@ describe('DPNS Contract', () => {
|
|
|
420
548
|
const validationResult = document.validate(dpp.protocolVersion);
|
|
421
549
|
const error = expectJsonSchemaError(validationResult);
|
|
422
550
|
|
|
423
|
-
expect(error.keyword)
|
|
424
|
-
|
|
551
|
+
expect(error.keyword)
|
|
552
|
+
.to
|
|
553
|
+
.equal('required');
|
|
554
|
+
expect(error.params.missingProperty)
|
|
555
|
+
.to
|
|
556
|
+
.equal('subdomainRules');
|
|
425
557
|
});
|
|
426
558
|
|
|
427
559
|
it('should not have additional properties', async () => {
|
|
@@ -431,9 +563,16 @@ describe('DPNS Contract', () => {
|
|
|
431
563
|
const validationResult = document.validate(dpp.protocolVersion);
|
|
432
564
|
const error = expectJsonSchemaError(validationResult);
|
|
433
565
|
|
|
434
|
-
expect(error.keyword)
|
|
435
|
-
|
|
436
|
-
|
|
566
|
+
expect(error.keyword)
|
|
567
|
+
.to
|
|
568
|
+
.equal('additionalProperties');
|
|
569
|
+
expect(error.instancePath)
|
|
570
|
+
.to
|
|
571
|
+
.equal('/subdomainRules');
|
|
572
|
+
expect(error.params.additionalProperties)
|
|
573
|
+
.to
|
|
574
|
+
.deep
|
|
575
|
+
.equal(['someOtherProperty']);
|
|
437
576
|
});
|
|
438
577
|
|
|
439
578
|
describe('allowSubdomains', () => {
|
|
@@ -444,8 +583,13 @@ describe('DPNS Contract', () => {
|
|
|
444
583
|
const validationResult = document.validate(dpp.protocolVersion);
|
|
445
584
|
const error = expectJsonSchemaError(validationResult);
|
|
446
585
|
|
|
447
|
-
expect(error.keyword)
|
|
448
|
-
|
|
586
|
+
expect(error.keyword)
|
|
587
|
+
.to
|
|
588
|
+
.equal('type');
|
|
589
|
+
expect(error.instancePath)
|
|
590
|
+
.to
|
|
591
|
+
.deep
|
|
592
|
+
.equal('/subdomainRules/allowSubdomains');
|
|
449
593
|
});
|
|
450
594
|
});
|
|
451
595
|
});
|