Skip to content

Commit

Permalink
fix: isCel2 test
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasbrugneaux committed Aug 22, 2024
1 parent 63c564c commit 8cadc5b
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 54 deletions.
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,15 @@
"files": [
"lib/**/*"
],
"exports": {
".": "./lib/index.js"
},
"peerDependencies": {
"web3": ">= 4.0.2 < 5"
},
"devDependencies": {
"@celo/dev-utils": "^0.0.5",
"@celo/devchain-anvil": "12.0.0-canary.0",
"@celo/devchain-anvil": "11.0.0-canary.0",
"@celo/typescript": "^0.0.2",
"@types/bun": "^1.1.6",
"eslint": "^9.8.0",
Expand Down
47 changes: 2 additions & 45 deletions src/tests/__snapshots__/index.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -18,51 +18,8 @@ CeloTransactionTypesPlugin {
"wallet": [],
},
"_emitter": EventEmitter {
"_events": {
"CONFIG_CHANGE": [
EE {
"context": [Circular],
"fn": [Function],
"once": false,
},
EE {
"context": [Circular],
"fn": [Function],
"once": false,
},
EE {
"context": [Circular],
"fn": [Function],
"once": false,
},
EE {
"context": [Circular],
"fn": [Function],
"once": false,
},
EE {
"context": [Circular],
"fn": [Function],
"once": false,
},
EE {
"context": [Circular],
"fn": [Function],
"once": false,
},
EE {
"context": [Circular],
"fn": [Function],
"once": false,
},
EE {
"context": [Circular],
"fn": [Function],
"once": false,
},
],
},
"_eventsCount": 1,
"_events": {},
"_eventsCount": 0,
"maxListeners": 9007199254740991,
},
"_requestManager": Web3RequestManager {
Expand Down
2 changes: 1 addition & 1 deletion src/tests/__snapshots__/utils.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ exports[`Types tx types should be configured 1`] = `
"eip1559": "0x02",
"ethereum-legacy": "",
}
`;
`;
1 change: 1 addition & 0 deletions src/tests/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ describe("CeloTransactionTypesPlugin", () => {
test("should be registered under .celo namespace", () => {
expect(web3.celo).toMatchSnapshot();
});
});
14 changes: 7 additions & 7 deletions src/tests/utils.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { describe, expect, test } from "bun:test";
import {
CeloChains,
getContractAddress,
getContractAddressFromRegistry,
isCel2,
isWhitelisted,
TxTypeToPrefix,
Expand Down Expand Up @@ -29,10 +29,10 @@ testWithAnvilL1("l1", (web3) => {
const plugin = new CeloTransactionTypesPlugin();
web3.registerPlugin(plugin);

describe("getContractAddress()", () => {
describe("getContractAddressFromRegistry()", () => {
test("returns a contract address", async () => {
expect(
getContractAddress(plugin, "FeeCurrencyWhitelist")
getContractAddressFromRegistry(plugin, "FeeCurrencyWhitelist")
).resolves.toMatch(/0x[0-9a-f]{40}/i);
});
});
Expand All @@ -44,7 +44,7 @@ testWithAnvilL1("l1", (web3) => {
test("isWhitelisted()", () => {
expect(isWhitelisted(plugin, "0x123")).resolves.toBe(false);
expect(
isWhitelisted(plugin, "0x874069Fa1Eb16D44d622F2e0Ca25eeA172369bC1")
isWhitelisted(plugin, "0xc47bde654fEDA0d1dF4880f8BF00a5c650738586")
).resolves.toBe(true);
});
});
Expand All @@ -53,16 +53,16 @@ testWithAnvilL2("l2", (web3) => {
const plugin = new CeloTransactionTypesPlugin();
web3.registerPlugin(plugin);

describe("getContractAddress()", () => {
describe("getContractAddressFromRegistry()", () => {
test("returns a contract address", async () => {
expect(
getContractAddress(plugin, "FeeCurrencyDirectory")
getContractAddressFromRegistry(plugin, "FeeCurrencyDirectory")
).resolves.toMatch(/0x[0-9a-f]{40}/i);
});
});

describe("isCel2()", () => {
expect(isCel2(plugin)).resolves.toBe(false);
expect(isCel2(plugin)).resolves.toBe(true);
});

test("isWhitelisted", () => {
Expand Down

0 comments on commit 8cadc5b

Please sign in to comment.