Skip to content

Commit

Permalink
chore(test): update web test to use act from react
Browse files Browse the repository at this point in the history
  • Loading branch information
dtfiedler committed Sep 25, 2024
1 parent 0595db7 commit 91e49af
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 30 deletions.
3 changes: 2 additions & 1 deletion tests/e2e/web/src/App.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import '@testing-library/jest-dom';
import { act, render, screen, waitFor } from '@testing-library/react';
import { render, screen, waitFor } from '@testing-library/react';
import { act } from 'react';
import { DockerComposeEnvironment, Wait } from 'testcontainers';
import { beforeAll, describe, expect, it } from 'vitest';

Expand Down
61 changes: 32 additions & 29 deletions tests/e2e/web/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,35 +30,38 @@ function App() {
const [registryLoaded, setRegistryLoaded] = useState<boolean>(false);

useEffect(() => {
io.getInfo()
.then((state: any) => {
setContract(`\`\`\`json\n${JSON.stringify(state, null, 2)}`);
setIoContractSuccess(true);
})
.catch((error: any) => {
console.error(error);
setIoContractSuccess(false);
setContract('Error loading contract state');
})
.finally(() => {
setLoaded(true);
});
antRegistry
.accessControlList({
address: ANT_REGISTRY_ID,
})
.then((affiliatedAnts: { Owned: string[]; Controlled: string[] }) => {
setAnts(`\`\`\`json\n${JSON.stringify(affiliatedAnts, null, 2)}`);
setAntRegistrySuccess(true);
})
.catch((error: any) => {
console.error(error);
setAntRegistrySuccess(false);
setAnts('Error loading affiliated ants');
})
.finally(() => {
setRegistryLoaded(true);
});
Promise.all([
io
.getInfo()
.then((state: any) => {
setContract(`\`\`\`json\n${JSON.stringify(state, null, 2)}`);
setIoContractSuccess(true);
})
.catch((error: any) => {
console.error(error);
setIoContractSuccess(false);
setContract('Error loading contract state');
})
.finally(() => {
setLoaded(true);
}),
antRegistry
.accessControlList({
address: ANT_REGISTRY_ID,
})
.then((affiliatedAnts: { Owned: string[]; Controlled: string[] }) => {
setAnts(`\`\`\`json\n${JSON.stringify(affiliatedAnts, null, 2)}`);
setAntRegistrySuccess(true);
})
.catch((error: any) => {
console.error(error);
setAntRegistrySuccess(false);
setAnts('Error loading affiliated ants');
})
.finally(() => {
setRegistryLoaded(true);
}),
]);
}, []);

return (
Expand Down

0 comments on commit 91e49af

Please sign in to comment.