Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: CI

on:
push:
branches:
- main
pull_request:

jobs:
Expand Down
34 changes: 34 additions & 0 deletions tests/test_env.nim
Original file line number Diff line number Diff line change
@@ -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)
Loading