-
Notifications
You must be signed in to change notification settings - Fork 26
/
bridge.spec.ts
45 lines (38 loc) · 1.67 KB
/
bridge.spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import { ApiProvider } from "./api-provider";
import { BaseCrossChainAdapter } from "./base-chain-adapter";
import { PolkadotAdapter } from "./adapters/polkadot";
import { ChainId } from "./configs";
import { Bridge } from "./bridge";
import { AcalaAdapter } from "./adapters/acala";
describe("Bridge sdk usage", () => {
jest.setTimeout(300000);
const provider = new ApiProvider();
const availableAdapters: Record<string, BaseCrossChainAdapter> = {
polkadot: new PolkadotAdapter(),
// kusama: new KusamaAdapter(),
acala: new AcalaAdapter(),
// karura: new KaruraAdapter(),
// assetHubKusama: new AssetHubKusamaAdapter(),
// altair: new AltairAdapter(),
// shiden: new ShidenAdapter(),
// bifrost: new BifrostAdapter(),
// calamari: new CalamariAdapter(),
// shadow: new ShadowAdapter(),
// crab: new CrabAdapter(),
// integritee: new IntegriteeAdapter(),
// quartz: new QuartzAdapter(),
};
const bridge = new Bridge({
adapters: Object.values(availableAdapters),
});
test("1. bridge init should be ok", async () => {
expect(bridge.router.getRouters().length).toBeGreaterThanOrEqual(Object.keys(availableAdapters).length);
expect(bridge.router.getDestinationChains({ from: "acala" }).length).toBeGreaterThanOrEqual(0);
expect(bridge.router.getAvailableTokens({ from: "acala", to: "polkadot" }).length).toBeGreaterThanOrEqual(0);
});
test("2. find adapter should be ok", async () => {
const chains = Object.keys(availableAdapters) as ChainId[];
expect(bridge.findAdapter(chains[0])).toEqual(availableAdapters[chains[0]]);
expect(bridge.findAdapter(chains[1])).toEqual(availableAdapters[chains[1]]);
});
});