@@ -58,6 +58,35 @@ describe('Permission List Item', () => {
5858 const mockStartTime = 1736271776 ; // January 7, 2025;
5959
6060 describe ( 'NATIVE token permissions' , ( ) => {
61+ const mockExpiryTimestamp = 1767312000 ; // January 1, 2026
62+ const expiryHex = mockExpiryTimestamp . toString ( 16 ) . padStart ( 32 , '0' ) ;
63+ const termsHex = `0x${ '0' . repeat ( 32 ) } ${ expiryHex } ` as Hex ;
64+
65+ beforeEach ( ( ) => {
66+ // Configure mocks for delegation decoding
67+ ( decodeDelegations as jest . Mock ) . mockReturnValue ( [
68+ {
69+ delegate : '0x176059c27095647e995b5db678800f8ce7f581dd' ,
70+ authority : '0x0000000000000000000000000000000000000000' ,
71+ caveats : [
72+ {
73+ enforcer : '0x1046bb45c8d673d4ea75321280db34899413c069' ,
74+ terms : termsHex ,
75+ args : '0x' ,
76+ } ,
77+ ] ,
78+ salt : 0n ,
79+ signature : '0x' ,
80+ } ,
81+ ] ) ;
82+
83+ ( getDeleGatorEnvironment as jest . Mock ) . mockReturnValue ( {
84+ caveatEnforcers : {
85+ TimestampEnforcer : '0x1046bb45c8d673d4ea75321280db34899413c069' ,
86+ } ,
87+ } ) ;
88+ } ) ;
89+
6190 const mockNativeTokenStreamPermission : StoredGatorPermissionSanitized <
6291 Signer ,
6392 NativeTokenStreamPermission
@@ -163,11 +192,12 @@ describe('Permission List Item', () => {
163192 expect ( startDate ) . toBeInTheDocument ( ) ;
164193 expect ( startDate ) . toHaveTextContent ( '01/07/2025' ) ;
165194
166- // Verify expiration date is rendered
195+ // Verify expiration date is rendered with correct date (January 1, 2026)
167196 const expirationDate = getByTestId (
168197 'review-gator-permission-expiration-date' ,
169198 ) ;
170199 expect ( expirationDate ) . toBeInTheDocument ( ) ;
200+ expect ( expirationDate ) . toHaveTextContent ( '01/01/2026' ) ;
171201
172202 // Verify network name is rendered
173203 const networkName = getByTestId ( 'review-gator-permission-network-name' ) ;
@@ -210,11 +240,12 @@ describe('Permission List Item', () => {
210240 expect ( startDate ) . toBeInTheDocument ( ) ;
211241 expect ( startDate ) . toHaveTextContent ( '01/07/2025' ) ;
212242
213- // Verify expiration date is rendered
243+ // Verify expiration date is rendered with correct date (January 1, 2026)
214244 const expirationDate = getByTestId (
215245 'review-gator-permission-expiration-date' ,
216246 ) ;
217247 expect ( expirationDate ) . toBeInTheDocument ( ) ;
248+ expect ( expirationDate ) . toHaveTextContent ( '01/01/2026' ) ;
218249
219250 // Verify network name is rendered
220251 const networkName = getByTestId ( 'review-gator-permission-network-name' ) ;
@@ -229,6 +260,35 @@ describe('Permission List Item', () => {
229260 const mockTokenAddress : Hex =
230261 '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599' ;
231262
263+ const mockExpiryTimestamp = 1767312000 ; // January 1, 2026
264+ const expiryHex = mockExpiryTimestamp . toString ( 16 ) . padStart ( 32 , '0' ) ;
265+ const termsHex = `0x${ '0' . repeat ( 32 ) } ${ expiryHex } ` as Hex ;
266+
267+ beforeEach ( ( ) => {
268+ // Configure mocks for delegation decoding
269+ ( decodeDelegations as jest . Mock ) . mockReturnValue ( [
270+ {
271+ delegate : '0x176059c27095647e995b5db678800f8ce7f581dd' ,
272+ authority : '0x0000000000000000000000000000000000000000' ,
273+ caveats : [
274+ {
275+ enforcer : '0x1046bb45c8d673d4ea75321280db34899413c069' ,
276+ terms : termsHex ,
277+ args : '0x' ,
278+ } ,
279+ ] ,
280+ salt : 0n ,
281+ signature : '0x' ,
282+ } ,
283+ ] ) ;
284+
285+ ( getDeleGatorEnvironment as jest . Mock ) . mockReturnValue ( {
286+ caveatEnforcers : {
287+ TimestampEnforcer : '0x1046bb45c8d673d4ea75321280db34899413c069' ,
288+ } ,
289+ } ) ;
290+ } ) ;
291+
232292 const mockErc20TokenPeriodicPermission : StoredGatorPermissionSanitized <
233293 Signer ,
234294 Erc20TokenPeriodicPermission
@@ -336,11 +396,12 @@ describe('Permission List Item', () => {
336396 expect ( startDate ) . toBeInTheDocument ( ) ;
337397 expect ( startDate ) . toHaveTextContent ( '01/07/2025' ) ;
338398
339- // Verify expiration date is rendered
399+ // Verify expiration date is rendered with correct date (January 1, 2026)
340400 const expirationDate = getByTestId (
341401 'review-gator-permission-expiration-date' ,
342402 ) ;
343403 expect ( expirationDate ) . toBeInTheDocument ( ) ;
404+ expect ( expirationDate ) . toHaveTextContent ( '01/01/2026' ) ;
344405
345406 // Verify network name is rendered
346407 const networkName = getByTestId ( 'review-gator-permission-network-name' ) ;
@@ -383,6 +444,13 @@ describe('Permission List Item', () => {
383444 expect ( startDate ) . toBeInTheDocument ( ) ;
384445 expect ( startDate ) . toHaveTextContent ( '01/07/2025' ) ;
385446
447+ // Verify expiration date is rendered with correct date (January 1, 2026)
448+ const expirationDate = getByTestId (
449+ 'review-gator-permission-expiration-date' ,
450+ ) ;
451+ expect ( expirationDate ) . toBeInTheDocument ( ) ;
452+ expect ( expirationDate ) . toHaveTextContent ( '01/01/2026' ) ;
453+
386454 // Verify network name is rendered
387455 const networkName = getByTestId ( 'review-gator-permission-network-name' ) ;
388456 expect ( networkName ) . toHaveTextContent ( mockNetworkName ) ;
@@ -528,11 +596,13 @@ describe('Permission List Item', () => {
528596 } ) ;
529597
530598 it ( 'renders correct expiration date when permission has expiry' , ( ) => {
531- const mockExpiryTimestamp = 1744588800 ; // April 14, 2025
599+ const customExpiryTimestamp = 1744588800 ; // April 14, 2025
532600
533601 // Convert timestamp to hex for the caveat terms (32 bytes total, expiry in last 16 bytes)
534- const expiryHex = mockExpiryTimestamp . toString ( 16 ) . padStart ( 32 , '0' ) ;
535- const termsHex = `0x${ '0' . repeat ( 32 ) } ${ expiryHex } ` as Hex ;
602+ const customExpiryHex = customExpiryTimestamp
603+ . toString ( 16 )
604+ . padStart ( 32 , '0' ) ;
605+ const customTermsHex = `0x${ '0' . repeat ( 32 ) } ${ customExpiryHex } ` as Hex ;
536606
537607 // Mock decodeDelegations to return a delegation with TimestampEnforcer caveat
538608 ( decodeDelegations as jest . Mock ) . mockReturnValue ( [
@@ -542,7 +612,7 @@ describe('Permission List Item', () => {
542612 caveats : [
543613 {
544614 enforcer : '0x1046bb45c8d673d4ea75321280db34899413c069' ,
545- terms : termsHex ,
615+ terms : customTermsHex ,
546616 args : '0x' ,
547617 } ,
548618 ] ,
@@ -810,7 +880,7 @@ describe('Permission List Item', () => {
810880
811881 it ( 'renders "No expiration" when timestamp is zero' , ( ) => {
812882 // All zeros in the terms = timestamp 0
813- const termsHex = `0x${ '0' . repeat ( 64 ) } ` as Hex ;
883+ const zeroTermsHex = `0x${ '0' . repeat ( 64 ) } ` as Hex ;
814884
815885 ( decodeDelegations as jest . Mock ) . mockReturnValue ( [
816886 {
@@ -819,7 +889,7 @@ describe('Permission List Item', () => {
819889 caveats : [
820890 {
821891 enforcer : '0x1046bb45c8d673d4ea75321280db34899413c069' ,
822- terms : termsHex ,
892+ terms : zeroTermsHex ,
823893 args : '0x' ,
824894 } ,
825895 ] ,
0 commit comments