@@ -3,9 +3,9 @@ import { render, waitFor } from '@/tests/testing-library'
33import { useParams } from 'react-router-dom'
44import { describe , expect , it , vi } from 'vitest'
55import { AccountPage , accountFailedToLoadMessage } from './account-page'
6- import { algod } from '@/features/common/data'
6+ import { createAtomAndTimestamp } from '@/features/common/data'
77import { accountResultMother } from '@/tests/object-mother/account-result'
8- import { atom , createStore } from 'jotai'
8+ import { createStore } from 'jotai'
99import { descriptionListAssertion } from '@/tests/assertions/description-list-assertion'
1010import { accountResultsAtom } from '../data'
1111import {
@@ -24,6 +24,7 @@ import {
2424import { assetResultsAtom } from '@/features/assets/data'
2525import { assetResultMother } from '@/tests/object-mother/asset-result'
2626import { refreshButtonLabel } from '@/features/common/components/refresh-button'
27+ import { algod } from '@/features/common/data/algo-client'
2728
2829describe ( 'account-page' , ( ) => {
2930 describe ( 'when rendering an account using a invalid address' , ( ) => {
@@ -58,14 +59,14 @@ describe('account-page', () => {
5859 describe ( 'when rendering an account' , ( ) => {
5960 const accountResult = accountResultMother [ 'mainnet-BIQXAK67KSCKN3EJXT4S3RVXUBFOLZ45IQOBTSOQWOSR4LLULBTD54S5IA' ] ( ) . build ( )
6061 const assetResults = new Map ( [
61- [ 924268058 , atom ( assetResultMother [ 'mainnet-924268058' ] ( ) . build ( ) ) ] ,
62- [ 1010208883 , atom ( assetResultMother [ 'mainnet-1010208883' ] ( ) . build ( ) ) ] ,
63- [ 1096015467 , atom ( assetResultMother [ 'mainnet-1096015467' ] ( ) . build ( ) ) ] ,
62+ [ 924268058 , createAtomAndTimestamp ( assetResultMother [ 'mainnet-924268058' ] ( ) . build ( ) ) ] ,
63+ [ 1010208883 , createAtomAndTimestamp ( assetResultMother [ 'mainnet-1010208883' ] ( ) . build ( ) ) ] ,
64+ [ 1096015467 , createAtomAndTimestamp ( assetResultMother [ 'mainnet-1096015467' ] ( ) . build ( ) ) ] ,
6465 ] )
6566
6667 it ( 'should be rendered with the correct data' , ( ) => {
6768 const myStore = createStore ( )
68- myStore . set ( accountResultsAtom , new Map ( [ [ accountResult . address , atom ( accountResult ) ] ] ) )
69+ myStore . set ( accountResultsAtom , new Map ( [ [ accountResult . address , createAtomAndTimestamp ( accountResult ) ] ] ) )
6970 myStore . set ( assetResultsAtom , assetResults )
7071
7172 vi . mocked ( useParams ) . mockImplementation ( ( ) => ( { address : accountResult . address } ) )
@@ -100,17 +101,17 @@ describe('account-page', () => {
100101 describe ( 'when rendering an account with assets and applications' , ( ) => {
101102 const accountResult = accountResultMother [ 'mainnet-ORANGESCU7XMR2TFXSFTOHCUHNP6OYEPIKZW3JZANTCDHVQYMGQFYFIDDA' ] ( ) . build ( )
102103 const assetResults = new Map ( [
103- [ 1336655079 , atom ( accountResult [ 'created-assets' ] ! [ 0 ] ) ] ,
104- [ 1284444444 , atom ( assetResultMother [ 'mainnet-1284444444' ] ( ) . build ( ) ) ] ,
105- [ 1162292622 , atom ( assetResultMother [ 'mainnet-1162292622' ] ( ) . build ( ) ) ] ,
106- [ 1294765516 , atom ( assetResultMother [ 'mainnet-1294765516' ] ( ) . build ( ) ) ] ,
107- [ 1355858325 , atom ( assetResultMother [ 'mainnet-1355858325' ] ( ) . build ( ) ) ] ,
108- [ 1355898842 , atom ( assetResultMother [ 'mainnet-1355898842' ] ( ) . build ( ) ) ] ,
104+ [ 1336655079 , createAtomAndTimestamp ( accountResult [ 'created-assets' ] ! [ 0 ] ) ] ,
105+ [ 1284444444 , createAtomAndTimestamp ( assetResultMother [ 'mainnet-1284444444' ] ( ) . build ( ) ) ] ,
106+ [ 1162292622 , createAtomAndTimestamp ( assetResultMother [ 'mainnet-1162292622' ] ( ) . build ( ) ) ] ,
107+ [ 1294765516 , createAtomAndTimestamp ( assetResultMother [ 'mainnet-1294765516' ] ( ) . build ( ) ) ] ,
108+ [ 1355858325 , createAtomAndTimestamp ( assetResultMother [ 'mainnet-1355858325' ] ( ) . build ( ) ) ] ,
109+ [ 1355898842 , createAtomAndTimestamp ( assetResultMother [ 'mainnet-1355898842' ] ( ) . build ( ) ) ] ,
109110 ] )
110111
111112 it ( 'should be rendered with the correct data' , ( ) => {
112113 const myStore = createStore ( )
113- myStore . set ( accountResultsAtom , new Map ( [ [ accountResult . address , atom ( accountResult ) ] ] ) )
114+ myStore . set ( accountResultsAtom , new Map ( [ [ accountResult . address , createAtomAndTimestamp ( accountResult ) ] ] ) )
114115 myStore . set ( assetResultsAtom , assetResults )
115116
116117 vi . mocked ( useParams ) . mockImplementation ( ( ) => ( { address : accountResult . address } ) )
@@ -147,7 +148,7 @@ describe('account-page', () => {
147148
148149 it ( 'should be rendered with the correct data' , ( ) => {
149150 const myStore = createStore ( )
150- myStore . set ( accountResultsAtom , new Map ( [ [ accountResult . address , atom ( accountResult ) ] ] ) )
151+ myStore . set ( accountResultsAtom , new Map ( [ [ accountResult . address , createAtomAndTimestamp ( accountResult ) ] ] ) )
151152
152153 vi . mocked ( useParams ) . mockImplementation ( ( ) => ( { address : accountResult . address } ) )
153154
@@ -182,14 +183,14 @@ describe('account-page', () => {
182183 describe ( 'when rendering an account that becomes stale' , ( ) => {
183184 const accountResult = accountResultMother [ 'mainnet-BIQXAK67KSCKN3EJXT4S3RVXUBFOLZ45IQOBTSOQWOSR4LLULBTD54S5IA' ] ( ) . build ( )
184185 const assetResults = new Map ( [
185- [ 924268058 , atom ( assetResultMother [ 'mainnet-924268058' ] ( ) . build ( ) ) ] ,
186- [ 1010208883 , atom ( assetResultMother [ 'mainnet-1010208883' ] ( ) . build ( ) ) ] ,
187- [ 1096015467 , atom ( assetResultMother [ 'mainnet-1096015467' ] ( ) . build ( ) ) ] ,
186+ [ 924268058 , createAtomAndTimestamp ( assetResultMother [ 'mainnet-924268058' ] ( ) . build ( ) ) ] ,
187+ [ 1010208883 , createAtomAndTimestamp ( assetResultMother [ 'mainnet-1010208883' ] ( ) . build ( ) ) ] ,
188+ [ 1096015467 , createAtomAndTimestamp ( assetResultMother [ 'mainnet-1096015467' ] ( ) . build ( ) ) ] ,
188189 ] )
189190
190191 it ( 'should be rendered with the refresh button' , ( ) => {
191192 const myStore = createStore ( )
192- myStore . set ( accountResultsAtom , new Map ( [ [ accountResult . address , atom ( accountResult ) ] ] ) )
193+ myStore . set ( accountResultsAtom , new Map ( [ [ accountResult . address , createAtomAndTimestamp ( accountResult ) ] ] ) )
193194 myStore . set ( assetResultsAtom , assetResults )
194195
195196 vi . mocked ( useParams ) . mockImplementation ( ( ) => ( { address : accountResult . address } ) )
0 commit comments