Skip to content

Commit b042a46

Browse files
committed
Colocate test cases
1 parent 55eeeca commit b042a46

6 files changed

Lines changed: 179 additions & 180 deletions

packages/arb-token-bridge-ui/src/components/TransferPanel/TransferPanel.default-tokens.integration.test.tsx

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,65 @@
11
import { describe, it } from 'vitest';
22

33
import {
4-
defaultTokenCases,
4+
type RouteTokenCase,
55
expectTokenButtonSymbol,
66
expectTokenPanelSymbol,
77
nonConnectedDestinationAddress,
88
renderTransferPanel,
99
setupTransferPanelLifiIntegrationSuite,
1010
} from './TransferPanel.integration.helpers';
1111

12+
const defaultTokenCases: RouteTokenCase[] = [
13+
{
14+
sourceChain: 'ethereum',
15+
destinationChain: 'apechain',
16+
expectedSourceSymbol: 'APE',
17+
expectedDestinationSymbol: 'APE',
18+
expectedSourcePanelSymbols: ['APE'],
19+
expectedDestinationPanelSymbols: ['APE', 'USDC.e', 'USDT', 'WETH'],
20+
},
21+
{
22+
sourceChain: 'apechain',
23+
destinationChain: 'ethereum',
24+
expectedSourceSymbol: 'APE',
25+
expectedDestinationSymbol: 'APE',
26+
expectedSourcePanelSymbols: ['APE'],
27+
expectedDestinationPanelSymbols: ['APE', 'USDC', 'USDT', 'WETH', 'ETH'],
28+
},
29+
{
30+
sourceChain: 'ethereum',
31+
destinationChain: 'superposition',
32+
expectedSourceSymbol: 'ETH',
33+
expectedDestinationSymbol: 'ETH',
34+
expectedSourcePanelSymbols: ['ETH'],
35+
expectedDestinationPanelSymbols: ['ETH', 'USDC.e', 'WETH'],
36+
},
37+
{
38+
sourceChain: 'superposition',
39+
destinationChain: 'ethereum',
40+
expectedSourceSymbol: 'ETH',
41+
expectedDestinationSymbol: 'ETH',
42+
expectedSourcePanelSymbols: ['ETH'],
43+
expectedDestinationPanelSymbols: ['ETH', 'USDC', 'WETH'],
44+
},
45+
{
46+
sourceChain: 'apechain',
47+
destinationChain: 'superposition',
48+
expectedSourceSymbol: 'APE',
49+
expectedDestinationSymbol: 'ETH',
50+
expectedSourcePanelSymbols: ['APE'],
51+
expectedDestinationPanelSymbols: ['ETH', 'USDC.e', 'WETH'],
52+
},
53+
{
54+
sourceChain: 'superposition',
55+
destinationChain: 'apechain',
56+
expectedSourceSymbol: 'ETH',
57+
expectedDestinationSymbol: 'APE',
58+
expectedSourcePanelSymbols: ['ETH'],
59+
expectedDestinationPanelSymbols: ['APE', 'USDC.e', 'WETH'],
60+
},
61+
];
62+
1263
describe.sequential('TransferPanel LiFi Integration - Default Token', () => {
1364
setupTransferPanelLifiIntegrationSuite();
1465

packages/arb-token-bridge-ui/src/components/TransferPanel/TransferPanel.eth-weth.integration.test.tsx

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,53 @@ import { constants } from 'ethers';
22
import { describe, it } from 'vitest';
33

44
import {
5-
ethWethCases,
5+
type RouteTokenCase,
66
expectTokenButtonSymbol,
77
expectTokenPanelSymbol,
88
nonConnectedDestinationAddress,
99
renderTransferPanel,
1010
setupTransferPanelLifiIntegrationSuite,
1111
} from './TransferPanel.integration.helpers';
1212

13+
const ethWethCases: RouteTokenCase[] = [
14+
{
15+
sourceChain: 'ethereum',
16+
destinationChain: 'apechain',
17+
expectedSourceSymbol: 'APE',
18+
expectedDestinationSymbol: 'WETH',
19+
},
20+
{
21+
sourceChain: 'apechain',
22+
destinationChain: 'ethereum',
23+
expectedSourceSymbol: 'APE',
24+
expectedDestinationSymbol: 'ETH',
25+
},
26+
{
27+
sourceChain: 'ethereum',
28+
destinationChain: 'superposition',
29+
expectedSourceSymbol: 'ETH',
30+
expectedDestinationSymbol: 'ETH',
31+
},
32+
{
33+
sourceChain: 'superposition',
34+
destinationChain: 'ethereum',
35+
expectedSourceSymbol: 'ETH',
36+
expectedDestinationSymbol: 'ETH',
37+
},
38+
{
39+
sourceChain: 'apechain',
40+
destinationChain: 'superposition',
41+
expectedSourceSymbol: 'APE',
42+
expectedDestinationSymbol: 'ETH',
43+
},
44+
{
45+
sourceChain: 'superposition',
46+
destinationChain: 'apechain',
47+
expectedSourceSymbol: 'ETH',
48+
expectedDestinationSymbol: 'WETH',
49+
},
50+
];
51+
1352
describe.sequential('TransferPanel LiFi Integration - ETH/WETH Override', () => {
1453
setupTransferPanelLifiIntegrationSuite();
1554

packages/arb-token-bridge-ui/src/components/TransferPanel/TransferPanel.integration.helpers.tsx

Lines changed: 0 additions & 168 deletions
Original file line numberDiff line numberDiff line change
@@ -34,174 +34,6 @@ export const usdcAddressByChain: Record<ChainQuerySlug, string> = {
3434
superposition: CommonAddress.Superposition.USDCe,
3535
};
3636

37-
export const defaultTokenCases: RouteTokenCase[] = [
38-
{
39-
sourceChain: 'ethereum',
40-
destinationChain: 'apechain',
41-
expectedSourceSymbol: 'APE',
42-
expectedDestinationSymbol: 'APE',
43-
expectedSourcePanelSymbols: ['APE'],
44-
expectedDestinationPanelSymbols: ['APE', 'USDC.e', 'USDT', 'WETH'],
45-
},
46-
{
47-
sourceChain: 'apechain',
48-
destinationChain: 'ethereum',
49-
expectedSourceSymbol: 'APE',
50-
expectedDestinationSymbol: 'APE',
51-
expectedSourcePanelSymbols: ['APE'],
52-
expectedDestinationPanelSymbols: ['APE', 'USDC', 'USDT', 'WETH', 'ETH'],
53-
},
54-
{
55-
sourceChain: 'ethereum',
56-
destinationChain: 'superposition',
57-
expectedSourceSymbol: 'ETH',
58-
expectedDestinationSymbol: 'ETH',
59-
expectedSourcePanelSymbols: ['ETH'],
60-
expectedDestinationPanelSymbols: ['ETH', 'USDC.e', 'WETH'],
61-
},
62-
{
63-
sourceChain: 'superposition',
64-
destinationChain: 'ethereum',
65-
expectedSourceSymbol: 'ETH',
66-
expectedDestinationSymbol: 'ETH',
67-
expectedSourcePanelSymbols: ['ETH'],
68-
expectedDestinationPanelSymbols: ['ETH', 'USDC', 'WETH'],
69-
},
70-
{
71-
sourceChain: 'apechain',
72-
destinationChain: 'superposition',
73-
expectedSourceSymbol: 'APE',
74-
expectedDestinationSymbol: 'ETH',
75-
expectedSourcePanelSymbols: ['APE'],
76-
expectedDestinationPanelSymbols: ['ETH', 'USDC.e', 'WETH'],
77-
},
78-
{
79-
sourceChain: 'superposition',
80-
destinationChain: 'apechain',
81-
expectedSourceSymbol: 'ETH',
82-
expectedDestinationSymbol: 'APE',
83-
expectedSourcePanelSymbols: ['ETH'],
84-
expectedDestinationPanelSymbols: ['APE', 'USDC.e', 'WETH'],
85-
},
86-
];
87-
88-
export const usdcCases: RouteTokenCase[] = [
89-
{
90-
sourceChain: 'ethereum',
91-
destinationChain: 'apechain',
92-
expectedSourceSymbol: 'USDC',
93-
expectedDestinationSymbol: 'USDC.e',
94-
},
95-
{
96-
sourceChain: 'apechain',
97-
destinationChain: 'ethereum',
98-
expectedSourceSymbol: 'USDC.e',
99-
expectedDestinationSymbol: 'USDC',
100-
},
101-
{
102-
sourceChain: 'ethereum',
103-
destinationChain: 'superposition',
104-
expectedSourceSymbol: 'USDC',
105-
expectedDestinationSymbol: 'USDC.e',
106-
},
107-
{
108-
sourceChain: 'superposition',
109-
destinationChain: 'ethereum',
110-
expectedSourceSymbol: 'USDC.e',
111-
expectedDestinationSymbol: 'USDC',
112-
},
113-
{
114-
sourceChain: 'apechain',
115-
destinationChain: 'superposition',
116-
expectedSourceSymbol: 'USDC.e',
117-
expectedDestinationSymbol: 'USDC.e',
118-
},
119-
{
120-
sourceChain: 'superposition',
121-
destinationChain: 'apechain',
122-
expectedSourceSymbol: 'USDC.e',
123-
expectedDestinationSymbol: 'USDC.e',
124-
},
125-
];
126-
127-
export const ethWethCases: RouteTokenCase[] = [
128-
{
129-
sourceChain: 'ethereum',
130-
destinationChain: 'apechain',
131-
expectedSourceSymbol: 'APE',
132-
expectedDestinationSymbol: 'WETH',
133-
},
134-
{
135-
sourceChain: 'apechain',
136-
destinationChain: 'ethereum',
137-
expectedSourceSymbol: 'APE',
138-
expectedDestinationSymbol: 'ETH',
139-
},
140-
{
141-
sourceChain: 'ethereum',
142-
destinationChain: 'superposition',
143-
expectedSourceSymbol: 'ETH',
144-
expectedDestinationSymbol: 'ETH',
145-
},
146-
{
147-
sourceChain: 'superposition',
148-
destinationChain: 'ethereum',
149-
expectedSourceSymbol: 'ETH',
150-
expectedDestinationSymbol: 'ETH',
151-
},
152-
{
153-
sourceChain: 'apechain',
154-
destinationChain: 'superposition',
155-
expectedSourceSymbol: 'APE',
156-
expectedDestinationSymbol: 'ETH',
157-
},
158-
{
159-
sourceChain: 'superposition',
160-
destinationChain: 'apechain',
161-
expectedSourceSymbol: 'ETH',
162-
expectedDestinationSymbol: 'WETH',
163-
},
164-
];
165-
166-
export const swapCases: RouteTokenCase[] = [
167-
{
168-
sourceChain: 'ethereum',
169-
destinationChain: 'apechain',
170-
expectedSourceSymbol: 'USDC',
171-
expectedDestinationSymbol: 'WETH',
172-
},
173-
{
174-
sourceChain: 'apechain',
175-
destinationChain: 'ethereum',
176-
expectedSourceSymbol: 'USDC.e',
177-
expectedDestinationSymbol: 'ETH',
178-
},
179-
{
180-
sourceChain: 'ethereum',
181-
destinationChain: 'superposition',
182-
expectedSourceSymbol: 'USDC',
183-
expectedDestinationSymbol: 'ETH',
184-
},
185-
{
186-
sourceChain: 'superposition',
187-
destinationChain: 'ethereum',
188-
expectedSourceSymbol: 'USDC.e',
189-
expectedDestinationSymbol: 'ETH',
190-
},
191-
{
192-
sourceChain: 'apechain',
193-
destinationChain: 'superposition',
194-
expectedSourceSymbol: 'USDC.e',
195-
expectedDestinationSymbol: 'ETH',
196-
},
197-
{
198-
sourceChain: 'superposition',
199-
destinationChain: 'apechain',
200-
expectedSourceSymbol: 'USDC.e',
201-
expectedDestinationSymbol: 'WETH',
202-
},
203-
];
204-
20537
function escapeRegExp(value: string): string {
20638
return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
20739
}

packages/arb-token-bridge-ui/src/components/TransferPanel/TransferPanel.swap.integration.test.tsx

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,55 @@ import { constants } from 'ethers';
22
import { describe, it } from 'vitest';
33

44
import {
5+
type RouteTokenCase,
56
expectTokenButtonSymbol,
67
expectTokenPanelSymbol,
78
getUsdcSourceToken,
89
nonConnectedDestinationAddress,
910
renderTransferPanel,
1011
setupTransferPanelLifiIntegrationSuite,
11-
swapCases,
1212
usdcAddressByChain,
1313
} from './TransferPanel.integration.helpers';
1414

15+
const swapCases: RouteTokenCase[] = [
16+
{
17+
sourceChain: 'ethereum',
18+
destinationChain: 'apechain',
19+
expectedSourceSymbol: 'USDC',
20+
expectedDestinationSymbol: 'WETH',
21+
},
22+
{
23+
sourceChain: 'apechain',
24+
destinationChain: 'ethereum',
25+
expectedSourceSymbol: 'USDC.e',
26+
expectedDestinationSymbol: 'ETH',
27+
},
28+
{
29+
sourceChain: 'ethereum',
30+
destinationChain: 'superposition',
31+
expectedSourceSymbol: 'USDC',
32+
expectedDestinationSymbol: 'ETH',
33+
},
34+
{
35+
sourceChain: 'superposition',
36+
destinationChain: 'ethereum',
37+
expectedSourceSymbol: 'USDC.e',
38+
expectedDestinationSymbol: 'ETH',
39+
},
40+
{
41+
sourceChain: 'apechain',
42+
destinationChain: 'superposition',
43+
expectedSourceSymbol: 'USDC.e',
44+
expectedDestinationSymbol: 'ETH',
45+
},
46+
{
47+
sourceChain: 'superposition',
48+
destinationChain: 'apechain',
49+
expectedSourceSymbol: 'USDC.e',
50+
expectedDestinationSymbol: 'WETH',
51+
},
52+
];
53+
1554
describe.sequential('TransferPanel LiFi Integration - Swap (USDC -> ETH/WETH)', () => {
1655
setupTransferPanelLifiIntegrationSuite();
1756

0 commit comments

Comments
 (0)