mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
* display methods accordion * add method_id to methods * query read method via public client * query read methods without inputs at accordion section open * add custom abi tabs * add proxy tabs * custom wagmi config if wc is not configured * remove ContractAbiItemConstant component * display tuple properties in method outputs * display read result * clean up * support nested arrays in the read result * re-write test for contract methods * change result view for address output * refactoring * fix tests * remove web3 provider fallback * fix tab loading * refactoring * add implementation contract selector * add "copy to clipboard" for address, remove top-level square brackets * add preview mode to contract method result * tests for read result * fix tests * change styles for result preview * review fix
74 lines
2.1 KiB
TypeScript
74 lines
2.1 KiB
TypeScript
import React from 'react';
|
|
|
|
import { test, expect } from 'playwright/lib';
|
|
|
|
import type { PropsDumb } from './ContractMethodResultWalletClient';
|
|
import { ContractMethodResultWalletClientDumb } from './ContractMethodResultWalletClient';
|
|
|
|
test('loading', async({ render }) => {
|
|
const props = {
|
|
txInfo: {
|
|
status: 'pending' as const,
|
|
error: null,
|
|
} as PropsDumb['txInfo'],
|
|
data: {
|
|
hash: '0x363574E6C5C71c343d7348093D84320c76d5Dd29' as `0x${ string }`,
|
|
},
|
|
onSettle: () => {},
|
|
};
|
|
|
|
const component = await render(<ContractMethodResultWalletClientDumb { ...props }/>);
|
|
await expect(component).toHaveScreenshot();
|
|
});
|
|
|
|
test('success', async({ render }) => {
|
|
const props = {
|
|
txInfo: {
|
|
status: 'success' as const,
|
|
error: null,
|
|
} as PropsDumb['txInfo'],
|
|
data: {
|
|
hash: '0x363574E6C5C71c343d7348093D84320c76d5Dd29' as `0x${ string }`,
|
|
},
|
|
onSettle: () => {},
|
|
};
|
|
|
|
const component = await render(<ContractMethodResultWalletClientDumb { ...props }/>);
|
|
await expect(component).toHaveScreenshot();
|
|
});
|
|
|
|
test('error +@mobile', async({ render }) => {
|
|
const props = {
|
|
txInfo: {
|
|
status: 'error' as const,
|
|
error: {
|
|
// eslint-disable-next-line max-len
|
|
message: 'missing revert data in call exception; Transaction reverted without a reason string [ See: https://links.ethers.org/v5-errors-CALL_EXCEPTION ]',
|
|
} as Error,
|
|
} as PropsDumb['txInfo'],
|
|
data: {
|
|
hash: '0x363574E6C5C71c343d7348093D84320c76d5Dd29' as `0x${ string }`,
|
|
},
|
|
onSettle: () => {},
|
|
};
|
|
|
|
const component = await render(<ContractMethodResultWalletClientDumb { ...props }/>);
|
|
await expect(component).toHaveScreenshot();
|
|
});
|
|
|
|
test('error in result', async({ render }) => {
|
|
const props = {
|
|
txInfo: {
|
|
status: 'idle' as const,
|
|
error: null,
|
|
} as unknown as PropsDumb['txInfo'],
|
|
data: {
|
|
message: 'wallet is not connected',
|
|
} as Error,
|
|
onSettle: () => {},
|
|
};
|
|
|
|
const component = await render(<ContractMethodResultWalletClientDumb { ...props }/>);
|
|
await expect(component).toHaveScreenshot();
|
|
});
|