Skip to content

Commit 945ea1d

Browse files
authored
chore(CI/tests): update workflows (#2660)
1 parent 02c8d51 commit 945ea1d

File tree

13 files changed

+56
-1872
lines changed

13 files changed

+56
-1872
lines changed

legacy_packages/chains/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"db:sync": "bun scripts/sync-db.ts",
3131
"build": "tsc && preconstruct build",
3232
"push": "yalc push",
33-
"test": "bun test"
33+
"test": "vitest"
3434
},
3535
"engines": {
3636
"node": ">=18"

legacy_packages/chains/test/getChainByChainId.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { expect, test } from "vitest";
12
import { getChainByChainId, Goerli } from "../src";
23

34
test("expect chainId 5 to be goerli", () => {

legacy_packages/chains/test/utils.test.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { beforeEach, describe, expect, test } from "vitest";
12
import { Ethereum } from "../src";
23
import {
34
type ChainRPCOptions,
@@ -79,7 +80,9 @@ describe("chains/utils", () => {
7980
],
8081
],
8182
])("getValidChainRPCs(Ethereum, %s, %s) = %p", (clientId, mode, expected) => {
82-
expect(getValidChainRPCs(Ethereum, clientId, mode)).toEqual(expected);
83+
expect(
84+
getValidChainRPCs(Ethereum, clientId, mode as "http" | "ws"),
85+
).toEqual(expected);
8386
});
8487

8588
test.each(CHAIN_RPC_TEST_CASES)(
@@ -188,7 +191,9 @@ describe("chains/utils with APP_BUNDLE_ID", () => {
188191
],
189192
],
190193
])("getValidChainRPCs(Ethereum, %s, %s) = %p", (clientId, mode, expected) => {
191-
expect(getValidChainRPCs(Ethereum, clientId, mode)).toEqual(expected);
194+
expect(
195+
getValidChainRPCs(Ethereum, clientId, mode as "http" | "ws"),
196+
).toEqual(expected);
192197
});
193198

194199
test.each([

legacy_packages/crypto/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"clean": "rm -rf dist/",
5050
"build": "tsc && preconstruct build",
5151
"push": "yalc push",
52-
"test": "bun test",
52+
"test": "vitest",
5353
"benchmark:aes-encrypt": "bun benchmark/aes-encrypt.ts",
5454
"benchmark:aes-decrypt": "bun benchmark/aes-decrypt.ts",
5555
"benchmark:sha256": "bun benchmark/sha256.ts",

legacy_packages/crypto/test/aes.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
import { describe, expect, it } from "vitest";
12
import { aesEncrypt, aesDecrypt, aesDecryptCompat } from "../src";
2-
33
import { AES } from "crypto-js";
44

55
describe("AES", () => {

legacy_packages/crypto/test/keccak256.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, expect, it } from "vitest";
12
import {
23
keccak256SyncHex,
34
keccak256SyncHexPrefixed,
@@ -12,6 +13,7 @@ const STRING_TO_HASH = "hello world";
1213
describe("keccak256", () => {
1314
it("keccak256SyncHexPrefixed === ethers.utils.keccak256", async () => {
1415
const out = keccak256SyncHexPrefixed(STRING_TO_HASH);
16+
// eslint-disable-next-line no-restricted-globals
1517
const ethersOut = utils.keccak256(Buffer.from(STRING_TO_HASH));
1618

1719
expect(out).toEqual(ethersOut);

legacy_packages/crypto/test/sha256.test.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, expect, it } from "vitest";
12
import { sha256, sha256Hex, sha256Sync, sha256HexSync } from "../src";
23
import { createHash } from "node:crypto";
34

@@ -6,7 +7,9 @@ const STRING_TO_HASH = "hello world";
67
describe("sha256", () => {
78
it("sha256", async () => {
89
const out = await sha256(STRING_TO_HASH);
9-
const hash = createHash("sha256").update(STRING_TO_HASH).digest();
10+
const hash = new Uint8Array(
11+
createHash("sha256").update(STRING_TO_HASH).digest(),
12+
);
1013
expect(out).toEqual(hash);
1114
});
1215

@@ -18,7 +21,9 @@ describe("sha256", () => {
1821

1922
it("sha256Sync", async () => {
2023
const out = sha256Sync(STRING_TO_HASH);
21-
const hash = createHash("sha256").update(STRING_TO_HASH).digest();
24+
const hash = new Uint8Array(
25+
createHash("sha256").update(STRING_TO_HASH).digest(),
26+
);
2227
expect(out).toEqual(hash);
2328
});
2429

legacy_packages/merkletree/package.json

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,24 +27,16 @@
2727
},
2828
"sideEffects": false,
2929
"dependencies": {
30-
"@thirdweb-dev/crypto": "workspace:*",
3130
"buffer": "^6.0.3",
3231
"buffer-reverse": "^1.0.1",
3332
"treeify": "^1.1.0"
3433
},
3534
"devDependencies": {
3635
"@preconstruct/cli": "2.7.0",
36+
"@thirdweb-dev/crypto": "workspace:*",
3737
"@thirdweb-dev/tsconfig": "workspace:*",
38-
"@types/benchmark": "^2.1.5",
3938
"@types/treeify": "^1.0.3",
40-
"benchmark": "^2.1.4",
41-
"circomlibjs": "^0.1.7",
4239
"eslint-config-thirdweb": "workspace:*",
43-
"ethereum-cryptography": "^1.2.0",
44-
"ethereumjs-util": "^7.1.5",
45-
"keccak256": "^1.0.6",
46-
"sha1": "^1.1.1",
47-
"tape": "^4.17.0",
4840
"typescript": "5.4.3"
4941
},
5042
"scripts": {
@@ -54,11 +46,7 @@
5446
"clean": "rm -rf dist/",
5547
"build": "tsc && preconstruct build",
5648
"push": "yalc push",
57-
"test": "bun test && node test/MerkleTree.js",
58-
"benchmark:aes-encrypt": "bun benchmark/aes-encrypt.ts",
59-
"benchmark:aes-decrypt": "bun benchmark/aes-decrypt.ts",
60-
"benchmark:sha256": "bun benchmark/sha256.ts",
61-
"benchmark": "bun run benchmark:aes-encrypt && bun run benchmark:aes-decrypt && bun run benchmark:sha256"
49+
"test": "vitest"
6250
},
6351
"engines": {
6452
"node": ">=18"

0 commit comments

Comments
 (0)