@@ -20,7 +20,6 @@ import { Message } from '../../../../src/core/message.js';
2020import { MessageStoreLevel } from '../../../../src/store/message-store-level.js' ;
2121import { RecordsQueryHandler } from '../../../../src/interfaces/records/handlers/records-query.js' ;
2222import { StorageController } from '../../../../src/store/storage-controller.js' ;
23- import { Temporal } from '@js-temporal/polyfill' ;
2423import { TestDataGenerator } from '../../../utils/test-data-generator.js' ;
2524import { TestStubGenerator } from '../../../utils/test-stub-generator.js' ;
2625
@@ -186,9 +185,9 @@ describe('RecordsQueryHandler.handle()', () => {
186185
187186 it ( 'should be able to range query by `dateCreated`' , async ( ) => {
188187 // 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' } ) ;
188+ const firstDayOf2021 = ' 2021-01-01T00:00:00.000000Z' ;
189+ const firstDayOf2022 = ' 2022-01-01T00:00:00.000000Z' ;
190+ const firstDayOf2023 = ' 2023-01-01T00:00:00.000000Z' ;
192191 const alice = await DidKeyResolver . generate ( ) ;
193192 const write1 = await TestDataGenerator . generateRecordsWrite ( { requester : alice , dateCreated : firstDayOf2021 , dateModified : firstDayOf2021 } ) ;
194193 const write2 = await TestDataGenerator . generateRecordsWrite ( { requester : alice , dateCreated : firstDayOf2022 , dateModified : firstDayOf2022 } ) ;
@@ -203,7 +202,7 @@ describe('RecordsQueryHandler.handle()', () => {
203202 expect ( writeReply3 . status . code ) . to . equal ( 202 ) ;
204203
205204 // testing `from` range
206- const lastDayOf2021 = Temporal . PlainDateTime . from ( { year : 2021 , month : 12 , day : 31 } ) . toString ( { smallestUnit : 'microseconds' } ) ;
205+ const lastDayOf2021 = ' 2021-12-31T00:00:00.000000Z' ;
207206 const recordsQuery1 = await TestDataGenerator . generateRecordsQuery ( {
208207 requester : alice ,
209208 filter : { dateCreated : { from : lastDayOf2021 } } ,
@@ -215,7 +214,7 @@ describe('RecordsQueryHandler.handle()', () => {
215214 expect ( reply1 . entries ! [ 1 ] . encodedData ) . to . equal ( Encoder . bytesToBase64Url ( write3 . dataBytes ! ) ) ;
216215
217216 // testing `to` range
218- const lastDayOf2022 = Temporal . PlainDateTime . from ( { year : 2022 , month : 12 , day : 31 } ) . toString ( { smallestUnit : 'microseconds' } ) ;
217+ const lastDayOf2022 = ' 2022-12-31T00:00:00.000000Z' ;
219218 const recordsQuery2 = await TestDataGenerator . generateRecordsQuery ( {
220219 requester : alice ,
221220 filter : { dateCreated : { to : lastDayOf2022 } } ,
@@ -227,7 +226,7 @@ describe('RecordsQueryHandler.handle()', () => {
227226 expect ( reply2 . entries ! [ 1 ] . encodedData ) . to . equal ( Encoder . bytesToBase64Url ( write2 . dataBytes ! ) ) ;
228227
229228 // testing `from` and `to` range
230- const lastDayOf2023 = Temporal . PlainDateTime . from ( { year : 2023 , month : 12 , day : 31 } ) . toString ( { smallestUnit : 'microseconds' } ) ;
229+ const lastDayOf2023 = ' 2023-12-31T00:00:00.000000Z' ;
231230 const recordsQuery3 = await TestDataGenerator . generateRecordsQuery ( {
232231 requester : alice ,
233232 filter : { dateCreated : { from : lastDayOf2022 , to : lastDayOf2023 } } ,
@@ -250,9 +249,9 @@ describe('RecordsQueryHandler.handle()', () => {
250249
251250 it ( 'should be able use range and exact match queries at the same time' , async ( ) => {
252251 // 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' } ) ;
252+ const firstDayOf2021 = ' 2021-01-01T00:00:00.000000Z' ;
253+ const firstDayOf2022 = ' 2022-01-01T00:00:00.000000Z' ;
254+ const firstDayOf2023 = ' 2023-01-01T00:00:00.000000Z' ;
256255 const alice = await DidKeyResolver . generate ( ) ;
257256 const schema = '2021And2022Schema' ;
258257 const write1 = await TestDataGenerator . generateRecordsWrite ( {
@@ -274,8 +273,8 @@ describe('RecordsQueryHandler.handle()', () => {
274273 expect ( writeReply3 . status . code ) . to . equal ( 202 ) ;
275274
276275 // 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' } ) ;
276+ const lastDayOf2021 = ' 2021-12-31T00:00:00.000000Z' ;
277+ const lastDayOf2023 = ' 2023-12-31T00:00:00.000000Z' ;
279278 const recordsQuery5 = await TestDataGenerator . generateRecordsQuery ( {
280279 requester : alice ,
281280 filter : {
0 commit comments