From cca19c659f5df4958affa7254c85f84d38c42110 Mon Sep 17 00:00:00 2001 From: itsumura-h Date: Tue, 18 Aug 2026 13:02:23 +0000 Subject: [PATCH 1/2] test on PR --- .github/workflows/ci.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a31d346..fa2b93d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,9 +1,6 @@ name: CI on: - push: - branches: - - main pull_request: jobs: From 7319eb5b50849fe16cc25ca66d3070b6fa19d689 Mon Sep 17 00:00:00 2001 From: itsumura-h Date: Tue, 18 Aug 2026 13:15:52 +0000 Subject: [PATCH 2/2] env test --- tests/test_env.nim | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 tests/test_env.nim diff --git a/tests/test_env.nim b/tests/test_env.nim new file mode 100644 index 0000000..b70dc95 --- /dev/null +++ b/tests/test_env.nim @@ -0,0 +1,34 @@ +discard """ + cmd: "nim c --skipUserCfg $file" +""" + +import unittest +import std/os +import std/osproc +import std/strutils +import icp_network + +const + ICP_PATH = "icp" + ENV_SAMPLE_DIR = "/application/examples/env_sample" + +suite "Environment variable canister tests": + test "local environment is returned by the canister": + ensureIcpNetworkStarted(ENV_SAMPLE_DIR) + + let originalDir = getCurrentDir() + try: + setCurrentDir(ENV_SAMPLE_DIR) + + let (deployOutput, deployExitCode) = execCmdEx(ICP_PATH & " deploy -y") + check deployExitCode == 0 + if deployExitCode == 0: + let (callOutput, callExitCode) = execCmdEx( + ICP_PATH & " canister call backend env '()'" + ) + check callExitCode == 0 + check callOutput.strip() == "(\"local\")" + else: + echo deployOutput + finally: + setCurrentDir(originalDir)