Skip to content

Commit d79dc98

Browse files
authored
test: added e2e test for CanisterStatus subnet path (#978)
1 parent 86a16f7 commit d79dc98

File tree

13 files changed

+3550
-4027
lines changed

13 files changed

+3550
-4027
lines changed

demos/sample-javascript/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"devDependencies": {
1818
"assert": "^2.0.0",
1919
"buffer": "^6.0.3",
20-
"esbuild": "^0.15.16",
20+
"esbuild": "^0.25.1",
2121
"events": "^3.2.0",
2222
"html-webpack-plugin": "^5.1.0",
2323
"size-limit": "^8.2.6",

docs/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## [Unreleased]
44

5+
### Added
6+
7+
- test: added e2e test for CanisterStatus requesting a subnet path, as a reference for getting the subnet id of a given canister id
8+
59
## [2.3.0] - 2025-02-07
610

711
### Added

e2e/node/basic/canisterStatus.test.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,21 @@ describe('canister status', () => {
4444

4545
expect(shouldThrow).rejects.toThrow();
4646
});
47+
it('should fetch the subnet id of a given canister', async () => {
48+
const counterObj = await (await counter)();
49+
const agent = await makeAgent();
50+
await agent.fetchRootKey();
51+
const statusMap = await CanisterStatus.request({
52+
canisterId: Principal.from(counterObj.canisterId),
53+
agent,
54+
paths: ['subnet'],
55+
});
56+
57+
const subnet = statusMap.get('subnet') as CanisterStatus.SubnetStatus;
58+
59+
expect(subnet).toBeDefined();
60+
61+
const principal = Principal.fromText(subnet.subnetId);
62+
expect(principal).toBeDefined();
63+
});
4764
});

e2e/node/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@
3232
"@typescript-eslint/eslint-plugin": "^5.30.5",
3333
"@typescript-eslint/parser": "^5.30.5",
3434
"agent1": "npm:@dfinity/agent@^1.4.0",
35-
"esbuild": "^0.15.16",
35+
"esbuild": "^0.25.1",
3636
"isomorphic-fetch": "^3.0.0",
3737
"locus": "^2.0.4",
3838
"node-webcrypto-p11": "^2.5.0",
3939
"size-limit": "^8.2.6",
4040
"text-encoding": "^0.7.0",
4141
"ts-node": "^10.8.2",
4242
"typescript": "^5.2.2",
43-
"vitest": "^0.34.6"
43+
"vitest": "^3.0.8"
4444
},
4545
"optionalDependencies": {
4646
"@rollup/rollup-linux-x64-gnu": "4.6.1"

0 commit comments

Comments
 (0)