-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Remove js and ts from taillwind content * Setup vitest * Add test cases
- Loading branch information
1 parent
7ab7e9f
commit 800126d
Showing
8 changed files
with
530 additions
and
4 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { describe, expect, it } from "vitest"; | ||
import { getChainConfigs } from "../utils"; | ||
|
||
describe.each(getChainConfigs(true).filter((c) => !!c.tokens.length))( | ||
`Should configure native token`, | ||
({ name, tokens }) => { | ||
it(name, () => { | ||
expect(tokens.some((t) => t.type === "native")).not.toBeFalsy(); | ||
}); | ||
}, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { describe, expect, it } from "vitest"; | ||
import { getChainConfigs } from "../utils"; | ||
|
||
describe.each(getChainConfigs(true).filter((c) => !!c.tokens.length))( | ||
`Test cross's target network: $network`, | ||
({ network, tokens }) => { | ||
describe.each(tokens)(`$symbol`, (token) => { | ||
if (token.cross.length) { | ||
it.each(token.cross)(`$target.network`, (cross) => { | ||
expect(cross.target.network).not.toBe(network); | ||
}); | ||
} else { | ||
it("Cross is empty", () => { | ||
expect(token.cross.length).toEqual(0); | ||
}); | ||
} | ||
}); | ||
}, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { describe, expect, it } from "vitest"; | ||
import { getChainConfig, getChainConfigs } from "../utils"; | ||
|
||
describe.each(getChainConfigs(true).filter((c) => !!c.tokens.length))( | ||
`Should configure target token`, | ||
({ network, tokens }) => { | ||
describe.each(tokens)(`Cross $symbol from ${network}`, (token) => { | ||
if (token.cross.length) { | ||
it.each(token.cross)(`to $target.network $target.symbol`, (cross) => { | ||
expect( | ||
getChainConfig(cross.target.network)?.tokens.find((t) => t.symbol === cross.target.symbol), | ||
).not.toBeUndefined(); | ||
}); | ||
} else { | ||
it("Cross is empty", () => { | ||
expect(token.cross.length).toEqual(0); | ||
}); | ||
} | ||
}); | ||
}, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { describe, expect, it } from "vitest"; | ||
import { getChainConfigs } from "../utils"; | ||
import { createPublicClient, http } from "viem"; | ||
import abi from "../abi/erc20"; | ||
|
||
describe.each(getChainConfigs(true).filter((c) => !!c.tokens.length && c.network !== "taiko"))( | ||
`Test token's decimals: $name`, | ||
({ tokens, ...chain }) => { | ||
const publicClient = createPublicClient({ chain, transport: http() }); | ||
|
||
it.each(tokens)(`$symbol`, async (token) => { | ||
if (token.type === "native") { | ||
expect(token.decimals).toEqual(18); | ||
} else { | ||
const decimals = await publicClient.readContract({ address: token.address, abi, functionName: "decimals" }); | ||
expect(token.decimals).toEqual(decimals); | ||
} | ||
}); | ||
}, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters