From f624210af9beffe2a41844a7b5bdc78a123f4f22 Mon Sep 17 00:00:00 2001 From: Kai Peacock Date: Tue, 15 Oct 2024 14:08:51 -0700 Subject: [PATCH] test: automatically deploys trap canister if it doesn't exist yet during e2e --- docs/CHANGELOG.md | 10 ++++++++-- e2e/node/basic/trap.test.ts | 9 ++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index f03b1b9e..ffdf743d 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -2,8 +2,11 @@ ## [Unreleased] -## [2.1.2] - 2024-09-30 -- fix: revert https://github.com/dfinity/agent-js/pull/923 allow option to set agent replica time +### Changed + +- test: automatically deploys trap canister if it doesn't exist yet during e2e + +### Added - fix: handle v3 traps correctly, pulling the reject_code and message from the certificate in the error response like v2. Example trap error message: ```txt @@ -17,6 +20,9 @@ AgentError: Call failed: ``` - feat: the `UpdateCallRejected` error now exposes `reject_code: ReplicaRejectCode`, `reject_message: string`, and `error_code?: string` properties directly on the error object. +## [2.1.2] - 2024-09-30 +- fix: revert https://github.com/dfinity/agent-js/pull/923 allow option to set agent replica time + ## [2.1.1] - 2024-09-13 ### Added diff --git a/e2e/node/basic/trap.test.ts b/e2e/node/basic/trap.test.ts index d6bee77e..160d3160 100644 --- a/e2e/node/basic/trap.test.ts +++ b/e2e/node/basic/trap.test.ts @@ -4,7 +4,14 @@ import util from 'util'; import exec from 'child_process'; const execAsync = util.promisify(exec.exec); -const { stdout } = await execAsync('dfx canister id trap'); +// eslint-disable-next-line prefer-const +let stdout; +try { + ({ stdout } = await execAsync('dfx canister id trap')); +} catch { + await execAsync('dfx deploy trap'); + ({ stdout } = await execAsync('dfx canister id trap')); +} export const idlFactory = ({ IDL }) => { return IDL.Service({