@@ -142,6 +142,26 @@ const PRIORITY_ORDER_1 = {
142
142
cosigner : '0xsigner' ,
143
143
}
144
144
145
+ const DUTCHV3_1 = {
146
+ orderHash : '0x42161' ,
147
+ offerer : '0xmaker' ,
148
+ encodedOrder : 'order1' ,
149
+ signature : 'sig1' ,
150
+ nonce : '1' ,
151
+ chainId : 42161 ,
152
+ orderStatus : ORDER_STATUS . OPEN ,
153
+ quoteId : QUOTE_ID ,
154
+ requestId : REQUEST_ID ,
155
+ cosignerData : {
156
+ decayStartBlock : 280615094 ,
157
+ exclusiveFiller : "0x0000000000000000000000000000000000000000" ,
158
+ exclusivityOverrideBps : 0 ,
159
+ inputOverride : 0 ,
160
+ outputOverrides :[ "0" ]
161
+ } ,
162
+ startingBaseFee : "1234" ,
163
+ }
164
+
145
165
const mockedGetCurrentTime = jest . mocked ( currentTimestampInSeconds )
146
166
const mockTime = ( time : number ) => {
147
167
mockedGetCurrentTime . mockImplementation ( ( ) => time . toString ( ) )
@@ -177,6 +197,13 @@ describe('OrdersRepository put item test', () => {
177
197
ordersRepository . putOrderAndUpdateNonceTransaction ( PRIORITY_ORDER_1 as unknown as UniswapXOrderEntity )
178
198
} ) . not . toThrow ( )
179
199
} )
200
+
201
+ it ( 'should successfully put a DutchV3 order in table' , async ( ) => {
202
+ expect ( ( ) => {
203
+ mockTime ( 1 )
204
+ ordersRepository . putOrderAndUpdateNonceTransaction ( DUTCHV3_1 as unknown as UniswapXOrderEntity )
205
+ } ) . not . toThrow ( )
206
+ } )
180
207
} )
181
208
182
209
describe ( 'OrdersRepository getOrders test' , ( ) => {
@@ -221,10 +248,11 @@ describe('OrdersRepository getOrders test', () => {
221
248
222
249
it ( 'should successfully get orders given an orderStatus' , async ( ) => {
223
250
const queryResult = await ordersRepository . getOrders ( 10 , { orderStatus : ORDER_STATUS . OPEN } )
224
- expect ( queryResult . orders ) . toHaveLength ( 3 )
251
+ expect ( queryResult . orders ) . toHaveLength ( 4 )
225
252
expect ( queryResult . orders ) . toContainEqual ( expect . objectContaining ( MOCK_ORDER_1 ) )
226
253
expect ( queryResult . orders ) . toContainEqual ( expect . objectContaining ( MOCK_ORDER_2 ) )
227
254
expect ( queryResult . orders ) . toContainEqual ( expect . objectContaining ( PRIORITY_ORDER_1 ) )
255
+ expect ( queryResult . orders ) . toContainEqual ( expect . objectContaining ( DUTCHV3_1 ) )
228
256
} )
229
257
230
258
it ( 'should return no orders for orderStatus' , async ( ) => {
@@ -407,12 +435,13 @@ describe('OrdersRepository getOrders test with pagination', () => {
407
435
let orders = await ordersRepository . getOrders ( 1 , { orderStatus : ORDER_STATUS . OPEN } )
408
436
expect ( orders . orders ) . toHaveLength ( 1 )
409
437
allOrders = allOrders . concat ( orders . orders )
410
- orders = await ordersRepository . getOrders ( 3 , { orderStatus : ORDER_STATUS . OPEN } , orders . cursor )
411
- expect ( orders . orders ) . toHaveLength ( 2 )
438
+ orders = await ordersRepository . getOrders ( 4 , { orderStatus : ORDER_STATUS . OPEN } , orders . cursor )
439
+ expect ( orders . orders ) . toHaveLength ( 3 )
412
440
allOrders = allOrders . concat ( orders . orders )
413
- expect ( allOrders ) . toHaveLength ( 3 )
441
+ expect ( allOrders ) . toHaveLength ( 4 )
414
442
expect ( allOrders ) . toContainEqual ( expect . objectContaining ( MOCK_ORDER_1 ) )
415
443
expect ( allOrders ) . toContainEqual ( expect . objectContaining ( MOCK_ORDER_2 ) )
444
+ expect ( allOrders ) . toContainEqual ( expect . objectContaining ( DUTCHV3_1 ) )
416
445
expect ( allOrders ) . toContainEqual ( expect . objectContaining ( PRIORITY_ORDER_1 ) )
417
446
expect ( orders . cursor ) . toEqual ( undefined )
418
447
} )
@@ -442,7 +471,7 @@ describe('OrdersRepository getOrders test with pagination', () => {
442
471
const orders = await ordersRepository . getOrders ( 3 , { orderStatus : ORDER_STATUS . OPEN } )
443
472
expect ( orders . orders ) . toHaveLength ( 3 )
444
473
expect ( orders . orders ) . toContainEqual ( expect . objectContaining ( MOCK_ORDER_5 ) )
445
- expect ( orders . orders ) . toContainEqual ( expect . objectContaining ( MOCK_ORDER_1 ) )
474
+ expect ( orders . orders ) . toContainEqual ( expect . objectContaining ( DUTCHV3_1 ) )
446
475
expect ( orders . orders ) . toContainEqual ( expect . objectContaining ( PRIORITY_ORDER_1 ) )
447
476
await expect ( ( ) => ordersRepository . getOrders ( 0 , { offerer : 'riley.eth' } , orders . cursor ) ) . rejects . toThrow (
448
477
Error ( 'Invalid cursor.' )
@@ -453,7 +482,7 @@ describe('OrdersRepository getOrders test with pagination', () => {
453
482
const orders = await ordersRepository . getOrders ( 3 , { orderStatus : ORDER_STATUS . OPEN } )
454
483
expect ( orders . orders ) . toHaveLength ( 3 )
455
484
expect ( orders . orders ) . toContainEqual ( expect . objectContaining ( MOCK_ORDER_5 ) )
456
- expect ( orders . orders ) . toContainEqual ( expect . objectContaining ( MOCK_ORDER_1 ) )
485
+ expect ( orders . orders ) . toContainEqual ( expect . objectContaining ( DUTCHV3_1 ) )
457
486
expect ( orders . orders ) . toContainEqual ( expect . objectContaining ( PRIORITY_ORDER_1 ) )
458
487
await expect ( ( ) => ordersRepository . getOrders ( 0 , { offerer : 'riley.eth' } , 'wrong_cursor' ) ) . rejects . toThrow (
459
488
Error ( 'Invalid cursor.' )
@@ -507,10 +536,12 @@ describe('OrdersRepository getOrders test with sorting', () => {
507
536
sort : 'between(1,3)' ,
508
537
desc : true ,
509
538
} )
510
- expect ( queryResult . orders ) . toHaveLength ( 4 )
539
+ expect ( queryResult . orders ) . toHaveLength ( 5 )
511
540
expect ( queryResult . orders ) . toContainEqual ( expect . objectContaining ( MOCK_ORDER_2 ) )
512
541
expect ( queryResult . orders ) . toContainEqual ( expect . objectContaining ( MOCK_ORDER_1 ) )
513
542
expect ( queryResult . orders ) . toContainEqual ( expect . objectContaining ( MOCK_ORDER_5 ) )
543
+ expect ( queryResult . orders ) . toContainEqual ( expect . objectContaining ( PRIORITY_ORDER_1 ) )
544
+ expect ( queryResult . orders ) . toContainEqual ( expect . objectContaining ( DUTCHV3_1 ) )
514
545
} )
515
546
516
547
it ( 'should return all orders for OPEN status and between 1,3 time ascending order' , async ( ) => {
@@ -520,11 +551,13 @@ describe('OrdersRepository getOrders test with sorting', () => {
520
551
sort : 'between(1,3)' ,
521
552
desc : false ,
522
553
} )
523
- expect ( queryResult . orders ) . toHaveLength ( 4 )
554
+ expect ( queryResult . orders ) . toHaveLength ( 5 )
524
555
expect ( queryResult . orders [ 0 ] ) . toEqual ( expect . objectContaining ( MOCK_ORDER_5 ) )
525
556
expect ( queryResult . orders [ 1 ] ) . toEqual ( expect . objectContaining ( PRIORITY_ORDER_1 ) )
526
- expect ( queryResult . orders [ 2 ] ) . toEqual ( expect . objectContaining ( MOCK_ORDER_1 ) )
527
- expect ( queryResult . orders [ 3 ] ) . toEqual ( expect . objectContaining ( MOCK_ORDER_2 ) )
557
+ expect ( queryResult . orders [ 2 ] ) . toEqual ( expect . objectContaining ( DUTCHV3_1 ) )
558
+ expect ( queryResult . orders [ 3 ] ) . toEqual ( expect . objectContaining ( MOCK_ORDER_1 ) )
559
+ expect ( queryResult . orders [ 4 ] ) . toEqual ( expect . objectContaining ( MOCK_ORDER_2 ) )
560
+
528
561
} )
529
562
} )
530
563
0 commit comments