Commit 10a208e2 authored by tom's avatar tom

enable Web3 only for certain tests

parent 3b51fe06
......@@ -36,6 +36,7 @@ const wagmiClient = createClient({
type Props = {
children: React.ReactNode;
withSocket?: boolean;
withWeb3?: boolean;
appContext?: {
pageProps: PageProps;
};
......@@ -48,7 +49,7 @@ const defaultAppContext = {
},
};
const TestApp = ({ children, withSocket, appContext = defaultAppContext }: Props) => {
const TestApp = ({ children, withSocket, withWeb3, appContext = defaultAppContext }: Props) => {
const [ queryClient ] = React.useState(() => new QueryClient({
defaultOptions: {
queries: {
......@@ -58,14 +59,18 @@ const TestApp = ({ children, withSocket, appContext = defaultAppContext }: Props
},
}));
const content = withWeb3 ? (
<WagmiConfig client={ wagmiClient }>
{ children }
</WagmiConfig>
) : children;
return (
<ChakraProvider theme={ theme }>
<QueryClientProvider client={ queryClient }>
<SocketProvider url={ withSocket ? `ws://localhost:${ PORT }` : undefined }>
<AppContextProvider { ...appContext }>
<WagmiConfig client={ wagmiClient }>
{ children }
</WagmiConfig>
{ content }
</AppContextProvider>
</SocketProvider>
</QueryClientProvider>
......
......@@ -16,7 +16,7 @@ const hooksConfig = {
},
};
test.skip('base view +@mobile +@dark-mode', async({ mount, page }) => {
test('base view +@mobile +@dark-mode', async({ mount, page }) => {
await page.route(CONTRACT_READ_METHODS_API_URL, (route) => route.fulfill({
status: 200,
body: JSON.stringify(contractMethodsMock.read),
......@@ -27,7 +27,7 @@ test.skip('base view +@mobile +@dark-mode', async({ mount, page }) => {
}));
const component = await mount(
<TestApp>
<TestApp withWeb3>
<ContractRead/>
</TestApp>,
{ hooksConfig },
......@@ -45,7 +45,7 @@ test.skip('base view +@mobile +@dark-mode', async({ mount, page }) => {
await expect(component).toHaveScreenshot();
});
test.skip('error result', async({ mount, page }) => {
test('error result', async({ mount, page }) => {
await page.route(CONTRACT_READ_METHODS_API_URL, (route) => route.fulfill({
status: 200,
body: JSON.stringify(contractMethodsMock.read),
......@@ -56,7 +56,7 @@ test.skip('error result', async({ mount, page }) => {
}));
const component = await mount(
<TestApp>
<TestApp withWeb3>
<ContractRead/>
</TestApp>,
{ hooksConfig },
......
......@@ -15,14 +15,14 @@ const hooksConfig = {
},
};
test.skip('base view +@mobile', async({ mount, page }) => {
test('base view +@mobile', async({ mount, page }) => {
await page.route(CONTRACT_READ_METHODS_API_URL, (route) => route.fulfill({
status: 200,
body: JSON.stringify(contractMethodsMock.write),
}));
const component = await mount(
<TestApp>
<TestApp withWeb3>
<ContractWrite/>
</TestApp>,
{ hooksConfig },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment