-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #366 from algorandfoundation/bug-int-decoding
bug: handle bigint encoding with algod
- Loading branch information
Showing
4 changed files
with
84 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
src/features/applications/pages/application-page-localnet.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import Arc32TestContractAppSpec from '@/tests/test-app-specs/test-contract.arc32.json' | ||
import { describe, beforeEach, it, vitest, afterEach, vi } from 'vitest' | ||
import { algorandFixture } from '@algorandfoundation/algokit-utils/testing' | ||
import { ApplicationId } from '../data/types' | ||
import { deploySmartContract } from '@/tests/utils/deploy-smart-contract' | ||
import { AppSpec } from '@algorandfoundation/algokit-utils/types/app-spec' | ||
import { executeComponentTest } from '@/tests/test-component' | ||
import { ApplicationPage } from './application-page' | ||
import { useParams } from 'react-router-dom' | ||
import { tableAssertion } from '@/tests/assertions/table-assertion' | ||
import { applicationGlobalStateLabel } from '../components/labels' | ||
import { render, waitFor } from '@/tests/testing-library' | ||
|
||
describe('application-page on localnet', () => { | ||
describe('when the application that has a global state that is a big int', () => { | ||
const localnet = algorandFixture() | ||
let appId: ApplicationId | ||
|
||
beforeEach(() => { | ||
vitest.clearAllMocks() | ||
}) | ||
|
||
beforeEach(localnet.beforeEach, 10e6) | ||
afterEach(() => { | ||
vitest.clearAllMocks() | ||
}) | ||
|
||
beforeEach(async () => { | ||
const { app } = await deploySmartContract(localnet, Arc32TestContractAppSpec as AppSpec) | ||
appId = Number(app.appId) | ||
}) | ||
|
||
it('should be rendered with the correct data', async () => { | ||
vi.mocked(useParams).mockImplementation(() => ({ applicationId: appId.toString() })) | ||
|
||
return executeComponentTest( | ||
() => { | ||
return render(<ApplicationPage />) | ||
}, | ||
async (component) => { | ||
await waitFor(async () => { | ||
const globalStateTab = await component.findByRole('tabpanel', { | ||
name: applicationGlobalStateLabel, | ||
}) | ||
await tableAssertion({ | ||
container: globalStateTab, | ||
rows: [{ cells: ['global_state_big_int', 'Uint', '33399922244455501'] }], | ||
}) | ||
}) | ||
} | ||
) | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.