From 18218152a545ddcce90cf1f3e2763cba8274dcad Mon Sep 17 00:00:00 2001 From: Aiqiao Yan Date: Fri, 15 May 2020 12:18:50 -0400 Subject: [PATCH] React to feedback --- __tests__/test-artifact-file.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 __tests__/test-artifact-file.sh diff --git a/__tests__/test-artifact-file.sh b/__tests__/test-artifact-file.sh new file mode 100755 index 0000000..708dc80 --- /dev/null +++ b/__tests__/test-artifact-file.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +path="$1" +expectedContent="$2" + +if [ "$path" == "" ]; then + echo "File path not provided" + exit 1 +fi + +if [ "$expectedContent" == "" ]; then + echo "Expected file contents not provided" + exit 1 +fi + +if [ ! -f "$path" ]; then + echo "Expected file $path does not exist" + exit 1 +fi + +actualContent=$(cat $path) +if [ "$actualContent" != "$expectedContent" ];then + echo "File contents are not correct, expected $expectedContent, received $actualContent" + exit 1 +fi \ No newline at end of file