Skip to content

Commit 93ab0b4

Browse files
committed
test: added e2e test for CanisterStatus subnet path
1 parent 86a16f7 commit 93ab0b4

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

docs/CHANGELOG.md

+4
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

+17
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
});

0 commit comments

Comments
 (0)