Skip to content

Commit edea949

Browse files
committed
Inline the date strings
1 parent 59cc6ba commit edea949

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

build/compile-validators.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import path from 'node:path';
1414
import url from 'node:url';
1515

1616
import Ajv from 'ajv';
17-
1817
import mkdirp from 'mkdirp';
1918
import standaloneCode from 'ajv/dist/standalone/index.js';
2019

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -186,9 +186,9 @@ describe('RecordsQueryHandler.handle()', () => {
186186

187187
it('should be able to range query by `dateCreated`', async () => {
188188
// scenario: 3 records authored by alice, created on first of 2021, 2022, and 2023 respectively, only the first 2 records share the same schema
189-
const firstDayOf2021 = Temporal.PlainDateTime.from({ year: 2021, month: 1, day: 1 }).toString({ smallestUnit: 'microseconds' });
190-
const firstDayOf2022 = Temporal.PlainDateTime.from({ year: 2022, month: 1, day: 1 }).toString({ smallestUnit: 'microseconds' });
191-
const firstDayOf2023 = Temporal.PlainDateTime.from({ year: 2023, month: 1, day: 1 }).toString({ smallestUnit: 'microseconds' });
189+
const firstDayOf2021 = '2021-01-01T00:00:00.000000Z';
190+
const firstDayOf2022 = '2022-01-01T00:00:00.000000Z';
191+
const firstDayOf2023 = '2023-01-01T00:00:00.000000Z';
192192
const alice = await DidKeyResolver.generate();
193193
const write1 = await TestDataGenerator.generateRecordsWrite({ requester: alice, dateCreated: firstDayOf2021, dateModified: firstDayOf2021 });
194194
const write2 = await TestDataGenerator.generateRecordsWrite({ requester: alice, dateCreated: firstDayOf2022, dateModified: firstDayOf2022 });
@@ -203,7 +203,7 @@ describe('RecordsQueryHandler.handle()', () => {
203203
expect(writeReply3.status.code).to.equal(202);
204204

205205
// testing `from` range
206-
const lastDayOf2021 = Temporal.PlainDateTime.from({ year: 2021, month: 12, day: 31 }).toString({ smallestUnit: 'microseconds' });
206+
const lastDayOf2021 = '2021-12-31T00:00:00.000000Z';
207207
const recordsQuery1 = await TestDataGenerator.generateRecordsQuery({
208208
requester : alice,
209209
filter : { dateCreated: { from: lastDayOf2021 } },
@@ -215,7 +215,7 @@ describe('RecordsQueryHandler.handle()', () => {
215215
expect(reply1.entries![1].encodedData).to.equal(Encoder.bytesToBase64Url(write3.dataBytes!));
216216

217217
// testing `to` range
218-
const lastDayOf2022 = Temporal.PlainDateTime.from({ year: 2022, month: 12, day: 31 }).toString({ smallestUnit: 'microseconds' });
218+
const lastDayOf2022 = '2022-12-31T00:00:00.000000Z';
219219
const recordsQuery2 = await TestDataGenerator.generateRecordsQuery({
220220
requester : alice,
221221
filter : { dateCreated: { to: lastDayOf2022 } },
@@ -227,7 +227,7 @@ describe('RecordsQueryHandler.handle()', () => {
227227
expect(reply2.entries![1].encodedData).to.equal(Encoder.bytesToBase64Url(write2.dataBytes!));
228228

229229
// testing `from` and `to` range
230-
const lastDayOf2023 = Temporal.PlainDateTime.from({ year: 2023, month: 12, day: 31 }).toString({ smallestUnit: 'microseconds' });
230+
const lastDayOf2023 = '2023-12-31T00:00:00.000000Z';
231231
const recordsQuery3 = await TestDataGenerator.generateRecordsQuery({
232232
requester : alice,
233233
filter : { dateCreated: { from: lastDayOf2022, to: lastDayOf2023 } },
@@ -250,9 +250,9 @@ describe('RecordsQueryHandler.handle()', () => {
250250

251251
it('should be able use range and exact match queries at the same time', async () => {
252252
// scenario: 3 records authored by alice, created on first of 2021, 2022, and 2023 respectively, only the first 2 records share the same schema
253-
const firstDayOf2021 = Temporal.PlainDateTime.from({ year: 2021, month: 1, day: 1 }).toString({ smallestUnit: 'microseconds' });
254-
const firstDayOf2022 = Temporal.PlainDateTime.from({ year: 2022, month: 1, day: 1 }).toString({ smallestUnit: 'microseconds' });
255-
const firstDayOf2023 = Temporal.PlainDateTime.from({ year: 2023, month: 1, day: 1 }).toString({ smallestUnit: 'microseconds' });
253+
const firstDayOf2021 = '2021-01-01T00:00:00.000000Z';
254+
const firstDayOf2022 = '2022-01-01T00:00:00.000000Z';
255+
const firstDayOf2023 = '2023-01-01T00:00:00.000000Z';
256256
const alice = await DidKeyResolver.generate();
257257
const schema = '2021And2022Schema';
258258
const write1 = await TestDataGenerator.generateRecordsWrite({
@@ -274,8 +274,8 @@ describe('RecordsQueryHandler.handle()', () => {
274274
expect(writeReply3.status.code).to.equal(202);
275275

276276
// testing range criterion with another exact match
277-
const lastDayOf2021 = Temporal.PlainDateTime.from({ year: 2021, month: 12, day: 31 }).toString({ smallestUnit: 'microseconds' });
278-
const lastDayOf2023 = Temporal.PlainDateTime.from({ year: 2023, month: 12, day: 31 }).toString({ smallestUnit: 'microseconds' });
277+
const lastDayOf2021 = '2021-12-31T00:00:00.000000Z';
278+
const lastDayOf2023 = '2023-12-31T00:00:00.000000Z';
279279
const recordsQuery5 = await TestDataGenerator.generateRecordsQuery({
280280
requester : alice,
281281
filter : {

0 commit comments

Comments
 (0)