@@ -24,10 +24,12 @@ import {
2424 applicationIdLabel ,
2525 applicationLocalStateByteLabel ,
2626 applicationLocalStateUintLabel ,
27+ applicationNameLabel ,
2728} from '../components/labels'
2829import { descriptionListAssertion } from '@/tests/assertions/description-list-assertion'
2930import { tableAssertion } from '@/tests/assertions/table-assertion'
3031import { modelsv2 , indexerModels } from 'algosdk'
32+ import { transactionResultMother } from '@/tests/object-mother/transaction-result'
3133
3234describe ( 'application-page' , ( ) => {
3335 describe ( 'when rendering an application using an invalid application Id' , ( ) => {
@@ -72,7 +74,7 @@ describe('application-page', () => {
7274 } )
7375
7476 describe ( 'when rendering an application' , ( ) => {
75- const applicationResult = applicationResultMother [ 'mainner -80441968' ] ( ) . build ( )
77+ const applicationResult = applicationResultMother [ 'mainnet -80441968' ] ( ) . build ( )
7678
7779 it ( 'should be rendered with the correct data' , ( ) => {
7880 const myStore = createStore ( )
@@ -119,6 +121,9 @@ describe('application-page', () => {
119121 } )
120122 )
121123 )
124+ vi . mocked ( indexer . searchForTransactions ( ) . applicationID ( applicationResult . id ) . limit ( 3 ) . do ) . mockImplementation ( ( ) =>
125+ Promise . resolve ( { currentRound : 123 , transactions : [ ] , nextToken : '' } )
126+ )
122127
123128 return executeComponentTest (
124129 ( ) => {
@@ -179,4 +184,37 @@ describe('application-page', () => {
179184 )
180185 } )
181186 } )
187+
188+ describe ( 'when rendering an application that has app name following algokit standard' , ( ) => {
189+ const applicationResult = applicationResultMother [ 'mainnet-1196727051' ] ( ) . build ( )
190+ const transactionResult = transactionResultMother [ 'mainnet-XCXQW7J5G5QSPVU5JFYEELVIAAABPLZH2I36BMNVZLVHOA75MPAQ' ] ( ) . build ( )
191+
192+ it ( 'should be rendered with the correct app name' , ( ) => {
193+ const myStore = createStore ( )
194+ myStore . set ( applicationResultsAtom , new Map ( [ [ applicationResult . id , atom ( applicationResult ) ] ] ) )
195+
196+ vi . mocked ( useParams ) . mockImplementation ( ( ) => ( { applicationId : applicationResult . id . toString ( ) } ) )
197+ vi . mocked ( indexer . searchForTransactions ( ) . applicationID ( applicationResult . id ) . limit ( 3 ) . do ) . mockImplementation ( ( ) =>
198+ Promise . resolve ( { currentRound : 123 , transactions : [ transactionResult ] , nextToken : '' } )
199+ )
200+
201+ return executeComponentTest (
202+ ( ) => {
203+ return render ( < ApplicationPage /> , undefined , myStore )
204+ } ,
205+ async ( component ) => {
206+ await waitFor ( async ( ) => {
207+ const detailsCard = component . getByLabelText ( applicationDetailsLabel )
208+ descriptionListAssertion ( {
209+ container : detailsCard ,
210+ items : [
211+ { term : applicationIdLabel , description : '1196727051' } ,
212+ { term : applicationNameLabel , description : 'cryptoless-JIUK4YAO2GU7UX36JHH35KWI4AJ3PDEYSRQ75PCJJKR5UBX6RQ6Y5UZSJQ' } ,
213+ ] ,
214+ } )
215+ } )
216+ }
217+ )
218+ } )
219+ } )
182220} )
0 commit comments