Skip to content

Commit

Permalink
test: refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
pcheremu committed Dec 5, 2023
1 parent e21fbc9 commit 228b4b2
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 28 deletions.
9 changes: 2 additions & 7 deletions .github/workflows/test-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,8 @@ jobs:
run: |
npm i zksync-cli
- if: runner.os == 'Windows'
name: Run tests
- name: Run tests
run: |
./src/tests/test_zksync_cli.sh
shell: bash

- if: runner.os == 'Linux' || runner.os == 'macOS'
name: Run tests
run: |
./src/tests/test_zksync_cli.sh

46 changes: 25 additions & 21 deletions src/tests/test_zksync_cli.sh
Original file line number Diff line number Diff line change
@@ -1,52 +1,56 @@
#!/bin/bash

declare -i RESULT_COMMON=0
declare -i counter_failed=0
declare -i counter_total=0

verify_result () {
RESULT_COMMON+=$?
counter_total+=1
RESULT=$?
if [ $RESULT -eq 0 ]; then
echo ""
echo "-----------> SUCCESS <-----------"
echo "---------------------------------"
else
echo ""
echo "-----------> FAILED <-----------"
echo "---------------------------------"
counter_failed+=1
fi
}


#BASIC
echo "----- BASIC -----"
echo ">>> Basic command like zksync-cli"
echo "1. BASIC"
echo "-----------> Basic command like zksync-cli"

npx zksync-cli
verify_result


echo ""
echo ">>> zksync-cli -V"
echo "-----------> zksync-cli -V"

npx zksync-cli -V
verify_result

echo ""
echo ">>> zksync-cli -h"
echo "-----------> zksync-cli -h"

npx zksync-cli -h
verify_result


#DEV PART
echo ""
echo "----- DEV PART -----"
echo ">>> zksync-cli dev"
echo "2. DEV PART"
echo "-----------> zksync-cli dev"

npx zksync-cli dev
verify_result


echo ""
echo ">>> zksync-cli dev config"
echo "-----------> zksync-cli dev config"

yes | npx zksync-cli dev config
verify_result
Expand All @@ -55,39 +59,39 @@ verify_result
#############

echo ""
echo ">>> zksync-cli dev start"
echo "-----------> zksync-cli dev start"

npx zksync-cli dev start
verify_result

echo ""
echo ">>> zksync-cli dev stop"
echo "-----------> zksync-cli dev stop"

npx zksync-cli dev stop
verify_result

echo ""
echo ">>> zksync-cli dev restart"
echo "-----------> zksync-cli dev restart"

npx zksync-cli dev restart
verify_result

##########

echo ""
echo ">>> zksync-cli dev logs"
echo "-----------> zksync-cli dev logs"

npx zksync-cli dev logs
verify_result

echo ""
echo ">>> zksync-cli dev clean"
echo "-----------> zksync-cli dev clean"

npx zksync-cli dev clean
verify_result

#echo ""
#echo ">>> zksync-cli dev install [email protected]"
#echo "-----------> zksync-cli dev install [email protected]"

#npx zksync-cli dev install [email protected]
#verify_result
Expand All @@ -96,32 +100,32 @@ verify_result


#echo ""
#echo ">>> zksync-cli dev update zksync-web3"
#echo "-----------> zksync-cli dev update zksync-web3"

#npx zksync-cli dev update zksync-web3
#verify_result

#echo ""
#echo ">>> zksync-cli dev uninstall zksync-web3"
#echo "-----------> zksync-cli dev uninstall zksync-web3"

#npx zksync-cli dev uninstall zksync-web3
#verify_result

echo ""
echo ">>> zksync-cli dev modules"
echo "-----------> zksync-cli dev modules"

npx zksync-cli dev modules
verify_result
##########

#echo ""
#echo ">>> zksync-cli create"
#echo "-----------> zksync-cli create"
#yes | npx zksync-cli create
#verify_result

if [ $RESULT_COMMON -eq 0 ]; then
echo success
echo "$counter_total tests Passed"
else
echo ERROR: RESULT_COMMON = $RESULT_COMMON
echo "Fail. $counter_failed failed test(s)"
exit 1 # terminate and indicate error
fi

0 comments on commit 228b4b2

Please sign in to comment.