Skip to content

Commit 59cc6ba

Browse files
committed
Update tests to make dateCreated validate
1 parent 3391b46 commit 59cc6ba

File tree

6 files changed

+47
-47
lines changed

6 files changed

+47
-47
lines changed

json-schemas/records/records-write.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@
132132
"type": "boolean"
133133
},
134134
"datePublished": {
135-
"type": "string",
135+
"type": "string",
136136
"format": "date-time"
137137
},
138138
"dataFormat": {

tests/interfaces/records/handlers/records-write.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ describe('RecordsWriteHandler.handle()', () => {
426426

427427
it('should return 400 if `dateCreated` and `dateModified` are not the same in an initial write', async () => {
428428
const { requester, message, dataStream } = await TestDataGenerator.generateRecordsWrite({
429-
dateCreated : '2023-01-10T10:20:30.405060',
429+
dateCreated : '2023-01-10T10:20:30.405060Z',
430430
dateModified : getCurrentTimeInHighPrecision() // this always generate a different timestamp
431431
});
432432
const tenant = requester.did;

tests/interfaces/records/messages/records-write.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ describe('RecordsWrite', () => {
2424
recipient : alice.did,
2525
data : TestDataGenerator.randomBytes(10),
2626
dataFormat : 'application/json',
27-
dateCreated : '2022-10-14T10:20:30.405060',
27+
dateCreated : '2022-10-14T10:20:30.405060Z',
2828
recordId : await TestDataGenerator.randomCborSha256Cid(),
2929
authorizationSignatureInput : Jws.createSignatureInput(alice)
3030
};

tests/validation/json-schemas/protocols/protocols-configure.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ describe('ProtocolsConfigure schema definition', () => {
2525
descriptor: {
2626
interface : 'Protocols',
2727
method : 'Configure',
28-
dateCreated : '123',
28+
dateCreated : '2022-10-14T10:20:30.405060Z',
2929
protocol : 'anyProtocolUri',
3030
definition : protocolDefinition
3131
},

tests/validation/json-schemas/records/records-query.spec.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ describe('RecordsQuery schema validation', () => {
77
descriptor: {
88
interface : 'Records',
99
method : 'Query',
10-
dateCreated : '123',
10+
dateCreated : '2022-10-14T10:20:30.405060Z',
1111
filter : { schema: 'anySchema' }
1212
},
1313
authorization: {
@@ -26,7 +26,7 @@ describe('RecordsQuery schema validation', () => {
2626
descriptor: {
2727
interface : 'Records',
2828
method : 'Query',
29-
dateCreated : '123',
29+
dateCreated : '2022-10-14T10:20:30.405060Z',
3030
filter : { schema: 'anySchema' }
3131
}
3232
};
@@ -41,7 +41,7 @@ describe('RecordsQuery schema validation', () => {
4141
descriptor: {
4242
interface : 'Records',
4343
method : 'Query',
44-
dateCreated : '123',
44+
dateCreated : '2022-10-14T10:20:30.405060Z',
4545
filter : { schema: 'anySchema' }
4646
},
4747
authorization: {
@@ -64,7 +64,7 @@ describe('RecordsQuery schema validation', () => {
6464
descriptor: {
6565
interface : 'Records',
6666
method : 'Query',
67-
dateCreated : '123',
67+
dateCreated : '2022-10-14T10:20:30.405060Z',
6868
filter : { schema: 'anySchema' },
6969
unknownProperty : 'unknownProperty' // unknown property
7070
},
@@ -90,7 +90,7 @@ describe('RecordsQuery schema validation', () => {
9090
descriptor: {
9191
interface : 'Records',
9292
method : 'Query',
93-
dateCreated : '123',
93+
dateCreated : '2022-10-14T10:20:30.405060Z',
9494
filter : { schema: 'anySchema' },
9595
dateSort : dateSortValue
9696
},
@@ -111,7 +111,7 @@ describe('RecordsQuery schema validation', () => {
111111
descriptor: {
112112
interface : 'Records',
113113
method : 'Query',
114-
dateCreated : '123',
114+
dateCreated : '2022-10-14T10:20:30.405060Z',
115115
filter : { schema: 'anySchema' },
116116
dateSort : 'unacceptable', // bad value
117117
},
@@ -135,7 +135,7 @@ describe('RecordsQuery schema validation', () => {
135135
descriptor: {
136136
interface : 'Records',
137137
method : 'Query',
138-
dateCreated : '123',
138+
dateCreated : '2022-10-14T10:20:30.405060Z',
139139
filter : { }
140140
},
141141
authorization: {
@@ -157,7 +157,7 @@ describe('RecordsQuery schema validation', () => {
157157
descriptor: {
158158
interface : 'Records',
159159
method : 'Query',
160-
dateCreated : '123',
160+
dateCreated : '2022-10-14T10:20:30.405060Z',
161161
filter : { dateCreated: { } } // empty `dateCreated` criteria
162162
},
163163
authorization: {
@@ -179,7 +179,7 @@ describe('RecordsQuery schema validation', () => {
179179
descriptor: {
180180
interface : 'Records',
181181
method : 'Query',
182-
dateCreated : '123',
182+
dateCreated : '2022-10-14T10:20:30.405060Z',
183183
filter : { dateCreated: { unexpectedProperty: 'anyValue' } } // unexpected property in `dateCreated` criteria
184184
},
185185
authorization: {

tests/validation/json-schemas/records/records-write.spec.ts

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ describe('RecordsWrite schema definition', () => {
1111
dataCid : 'anyCid',
1212
dataFormat : 'application/json',
1313
dataSize : 123,
14-
dateCreated : '2022-12-19T10:20:30.123456',
15-
dateModified : '2022-12-19T10:20:30.123456',
14+
dateCreated : '2022-12-19T10:20:30.123456Z',
15+
dateModified : '2022-12-19T10:20:30.123456Z',
1616
},
1717
authorization: {
1818
payload : 'anyPayload',
@@ -33,8 +33,8 @@ describe('RecordsWrite schema definition', () => {
3333
dataCid : 'anyCid',
3434
dataFormat : 'application/json',
3535
dataSize : 123,
36-
dateCreated : '2022-12-19T10:20:30.123456',
37-
dateModified : '2022-12-19T10:20:30.123456'
36+
dateCreated : '2022-12-19T10:20:30.123456Z',
37+
dateModified : '2022-12-19T10:20:30.123456Z'
3838
},
3939
authorization: {
4040
payload : 'anyPayload',
@@ -59,8 +59,8 @@ describe('RecordsWrite schema definition', () => {
5959
dataCid : 'anyCid',
6060
dataFormat : 'application/json',
6161
dataSize : 123,
62-
dateCreated : '2022-12-19T10:20:30.123456',
63-
dateModified : '2022-12-19T10:20:30.123456'
62+
dateCreated : '2022-12-19T10:20:30.123456Z',
63+
dateModified : '2022-12-19T10:20:30.123456Z'
6464
}
6565
};
6666

@@ -78,8 +78,8 @@ describe('RecordsWrite schema definition', () => {
7878
dataCid : 'anyCid',
7979
dataFormat : 'application/json',
8080
dataSize : 123,
81-
dateCreated : '2022-12-19T10:20:30.123456',
82-
dateModified : '2022-12-19T10:20:30.123456'
81+
dateCreated : '2022-12-19T10:20:30.123456Z',
82+
dateModified : '2022-12-19T10:20:30.123456Z'
8383
},
8484
authorization: {
8585
payload : 'anyPayload',
@@ -105,8 +105,8 @@ describe('RecordsWrite schema definition', () => {
105105
dataCid : 'anyCid',
106106
dataFormat : 'application/json',
107107
dataSize : 123,
108-
dateCreated : '2022-12-19T10:20:30.123456',
109-
dateModified : '2022-12-19T10:20:30.123456',
108+
dateCreated : '2022-12-19T10:20:30.123456Z',
109+
dateModified : '2022-12-19T10:20:30.123456Z',
110110
unknownProperty : 'unknownProperty' // unknown property
111111
},
112112
authorization: {
@@ -136,8 +136,8 @@ describe('RecordsWrite schema definition', () => {
136136
dataCid : 'anyCid',
137137
dataFormat : 'application/json',
138138
dataSize : 123,
139-
dateCreated : '2022-12-19T10:20:30.123456',
140-
dateModified : '2022-12-19T10:20:30.123456'
139+
dateCreated : '2022-12-19T10:20:30.123456Z',
140+
dateModified : '2022-12-19T10:20:30.123456Z'
141141
},
142142
authorization: {
143143
payload : 'anyPayload',
@@ -164,8 +164,8 @@ describe('RecordsWrite schema definition', () => {
164164
dataCid : 'anyCid',
165165
dataFormat : 'application/json',
166166
dataSize : 123,
167-
dateCreated : '2022-12-19T10:20:30.123456',
168-
dateModified : '2022-12-19T10:20:30.123456'
167+
dateCreated : '2022-12-19T10:20:30.123456Z',
168+
dateModified : '2022-12-19T10:20:30.123456Z'
169169
},
170170
authorization: {
171171
payload : 'anyPayload',
@@ -190,8 +190,8 @@ describe('RecordsWrite schema definition', () => {
190190
dataCid : 'anyCid',
191191
dataFormat : 'application/json',
192192
dataSize : 123,
193-
dateCreated : '2022-12-19T10:20:30.123456',
194-
dateModified : '2022-12-19T10:20:30.123456'
193+
dateCreated : '2022-12-19T10:20:30.123456Z',
194+
dateModified : '2022-12-19T10:20:30.123456Z'
195195
},
196196
authorization: {
197197
payload : 'anyPayload',
@@ -215,8 +215,8 @@ describe('RecordsWrite schema definition', () => {
215215
dataCid : 'anyCid',
216216
dataFormat : 'application/json',
217217
dataSize : 123,
218-
dateCreated : '2022-12-19T10:20:30.123456',
219-
dateModified : '2022-12-19T10:20:30.123456'
218+
dateCreated : '2022-12-19T10:20:30.123456Z',
219+
dateModified : '2022-12-19T10:20:30.123456Z'
220220
},
221221
authorization: {
222222
payload : 'anyPayload',
@@ -242,8 +242,8 @@ describe('RecordsWrite schema definition', () => {
242242
dataCid : 'anyCid',
243243
dataFormat : 'application/json',
244244
dataSize : 123,
245-
dateCreated : '2022-12-19T10:20:30.123456',
246-
dateModified : '2022-12-19T10:20:30.123456'
245+
dateCreated : '2022-12-19T10:20:30.123456Z',
246+
dateModified : '2022-12-19T10:20:30.123456Z'
247247
},
248248
authorization: {
249249
payload : 'anyPayload',
@@ -271,8 +271,8 @@ describe('RecordsWrite schema definition', () => {
271271
dataCid : 'anyCid',
272272
dataFormat : 'application/json',
273273
dataSize : 123,
274-
dateCreated : '2022-12-19T10:20:30.123456',
275-
dateModified : '2022-12-19T10:20:30.123456'
274+
dateCreated : '2022-12-19T10:20:30.123456Z',
275+
dateModified : '2022-12-19T10:20:30.123456Z'
276276
},
277277
authorization: {
278278
payload : 'anyPayload',
@@ -300,8 +300,8 @@ describe('RecordsWrite schema definition', () => {
300300
dataCid : 'anyCid',
301301
dataFormat : 'application/json',
302302
dataSize : 123,
303-
dateCreated : '2022-12-19T10:20:30.123456',
304-
dateModified : '2022-12-19T10:20:30.123456'
303+
dateCreated : '2022-12-19T10:20:30.123456Z',
304+
dateModified : '2022-12-19T10:20:30.123456Z'
305305
},
306306
authorization: {
307307
payload : 'anyPayload',
@@ -330,8 +330,8 @@ describe('RecordsWrite schema definition', () => {
330330
dataCid : 'anyCid',
331331
dataFormat : 'application/json',
332332
dataSize : 123,
333-
dateCreated : '2022-12-19T10:20:30.123456',
334-
dateModified : '2022-12-19T10:20:30.123456'
333+
dateCreated : '2022-12-19T10:20:30.123456Z',
334+
dateModified : '2022-12-19T10:20:30.123456Z'
335335
},
336336
authorization: {
337337
payload : 'anyPayload',
@@ -356,10 +356,10 @@ describe('RecordsWrite schema definition', () => {
356356
dataCid : 'anyCid',
357357
dataFormat : 'application/json',
358358
dataSize : 123,
359-
dateModified : '2022-12-19T10:20:30.123456',
359+
dateModified : '2022-12-19T10:20:30.123456Z',
360360
published : false,
361-
dateCreated : '2022-12-19T10:20:30.123456',
362-
datePublished : '2022-12-19T10:20:30.123456' // must not be present when not published
361+
dateCreated : '2022-12-19T10:20:30.123456Z',
362+
datePublished : '2022-12-19T10:20:30.123456Z' // must not be present when not published
363363
},
364364
authorization: {
365365
payload : 'anyPayload',
@@ -384,8 +384,8 @@ describe('RecordsWrite schema definition', () => {
384384
dataCid : 'anyCid',
385385
dataFormat : 'application/json',
386386
dataSize : 123,
387-
dateCreated : '2022-12-19T10:20:30.123456',
388-
dateModified : '2022-12-19T10:20:30.123456',
387+
dateCreated : '2022-12-19T10:20:30.123456Z',
388+
dateModified : '2022-12-19T10:20:30.123456Z',
389389
published : true //datePublished must be present
390390
},
391391
authorization: {
@@ -411,9 +411,9 @@ describe('RecordsWrite schema definition', () => {
411411
dataCid : 'anyCid',
412412
dataFormat : 'application/json',
413413
dataSize : 123,
414-
dateCreated : '2022-12-19T10:20:30.123456',
415-
dateModified : '2022-12-19T10:20:30.123456',
416-
datePublished : '2022-12-19T10:20:30.123456' //published must be present
414+
dateCreated : '2022-12-19T10:20:30.123456Z',
415+
dateModified : '2022-12-19T10:20:30.123456Z',
416+
datePublished : '2022-12-19T10:20:30.123456Z' //published must be present
417417
},
418418
authorization: {
419419
payload : 'anyPayload',

0 commit comments

Comments
 (0)