From 6e86224cb38184fdd4a0c8ff2df3589268131a14 Mon Sep 17 00:00:00 2001 From: c0utin Date: Fri, 27 Sep 2024 11:22:26 -0300 Subject: [PATCH] feat: initial structure setup tests script and hello --- dfx.json | 2 +- src/parsekoto_backend/tests/hello_test.sh | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100755 src/parsekoto_backend/tests/hello_test.sh diff --git a/dfx.json b/dfx.json index b6e6f8f..cd486fb 100644 --- a/dfx.json +++ b/dfx.json @@ -13,4 +13,4 @@ }, "output_env_file": ".env", "version": 1 -} \ No newline at end of file +} diff --git a/src/parsekoto_backend/tests/hello_test.sh b/src/parsekoto_backend/tests/hello_test.sh new file mode 100755 index 0000000..434a97b --- /dev/null +++ b/src/parsekoto_backend/tests/hello_test.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +# ANSI color codes for green and red +GREEN='\033[0;32m' +RED='\033[0;31m' +NC='\033[0m' # No Color + +# Test the greet function +RESPONSE=$(dfx canister call parsekoto_backend greet '("ICP")') + +# Verify the result +EXPECTED='"Hello, ICP!"' +if [[ "$RESPONSE" == *"$EXPECTED"* ]]; then + echo -e "${GREEN}Test passed: $RESPONSE${NC}" +else + echo -e "${RED}Test failed: Expected $EXPECTED but got $RESPONSE${NC}" + exit 1 +fi +