Update Test Suite
This commit is contained in:
parent
66436b598c
commit
4e51d42a04
|
@ -68,7 +68,7 @@ _tag_commit() {
|
||||||
echo "::debug::Create tag $INPUT_TAGGING_MESSAGE";
|
echo "::debug::Create tag $INPUT_TAGGING_MESSAGE";
|
||||||
git -c user.name="$INPUT_COMMIT_USER_NAME" -c user.email="$INPUT_COMMIT_USER_EMAIL" tag -a "$INPUT_TAGGING_MESSAGE" -m "$INPUT_TAGGING_MESSAGE";
|
git -c user.name="$INPUT_COMMIT_USER_NAME" -c user.email="$INPUT_COMMIT_USER_EMAIL" tag -a "$INPUT_TAGGING_MESSAGE" -m "$INPUT_TAGGING_MESSAGE";
|
||||||
else
|
else
|
||||||
echo " No tagging message supplied. No tag will be added.";
|
echo "No tagging message supplied. No tag will be added.";
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,16 +22,11 @@ setup() {
|
||||||
export INPUT_COMMIT_OPTIONS=""
|
export INPUT_COMMIT_OPTIONS=""
|
||||||
export INPUT_FILE_PATTERN="."
|
export INPUT_FILE_PATTERN="."
|
||||||
export INPUT_COMMIT_USER_NAME="Test Suite"
|
export INPUT_COMMIT_USER_NAME="Test Suite"
|
||||||
export INPUT_COMMIT_USER_NAME="test@github.com"
|
export INPUT_COMMIT_USER_EMAIL="test@github.com"
|
||||||
export INPUT_COMMIT_AUTHOR="Test Suite <test@users.noreply.github.com>"
|
export INPUT_COMMIT_AUTHOR="Test Suite <test@users.noreply.github.com>"
|
||||||
export INPUT_TAGGING_MESSAGE=""
|
export INPUT_TAGGING_MESSAGE=""
|
||||||
export INPUT_PUSH_OPTIONS=""
|
export INPUT_PUSH_OPTIONS=""
|
||||||
export INPUT_SKIP_DIRTY_CHECK=false
|
export INPUT_SKIP_DIRTY_CHECK=false
|
||||||
|
|
||||||
# TODO:
|
|
||||||
# - Create new Git Repo in ${BATS_TMPDIR}
|
|
||||||
# - Create some Files with some data
|
|
||||||
# - Create Init Commit
|
|
||||||
}
|
}
|
||||||
|
|
||||||
teardown() {
|
teardown() {
|
||||||
|
@ -40,7 +35,6 @@ teardown() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -rf "${test_repository}"
|
rm -rf "${test_repository}"
|
||||||
rm -rf "${BATS_TEST_DIRNAME}/tmpstubs"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
|
@ -60,28 +54,33 @@ main() {
|
||||||
|
|
||||||
@test "skip-dirty-on-clean-repo-failure" {
|
@test "skip-dirty-on-clean-repo-failure" {
|
||||||
|
|
||||||
touch "${test_repository}/new-file.txt"
|
# touch "${test_repository}/new-file.txt"
|
||||||
|
|
||||||
# INPUT_SKIP_DIRTY_CHECK=true
|
INPUT_SKIP_DIRTY_CHECK=true
|
||||||
|
INPUT_COMMIT_OPTIONS='--force'
|
||||||
|
|
||||||
# shellmock_expect git --match '-c user.name="$INPUT_COMMIT_USER_NAME" -c user.email="$INPUT_COMMIT_USER_EMAIL" commit -m "$INPUT_COMMIT_MESSAGE" --author="$INPUT_COMMIT_AUTHOR" ${INPUT_COMMIT_OPTIONS:+"${INPUT_COMMIT_OPTIONS_ARRAY[@]}"}'
|
shellmock_expect git --type exact --match "status -s ." --output "fuck"
|
||||||
|
shellmock_expect git --type exact --match "checkout master"
|
||||||
|
shellmock_expect git --type exact --match "add ."
|
||||||
|
shellmock_expect git --type partial --match '-c user.name=Test Suite -c user.email=test@github.com commit -m Commit Message --author=Test Suite <test@users.noreply.github.com> --force'
|
||||||
|
shellmock_expect git --type partial --match 'push origin'
|
||||||
|
|
||||||
run main
|
run main
|
||||||
|
|
||||||
echo $output;
|
shellmock_verify
|
||||||
|
[ "${capture[0]}" = "git-stub status -s -- ." ]
|
||||||
|
[ "${capture[1]}" = "git-stub checkout master" ]
|
||||||
|
[ "${capture[2]}" = "git-stub add ." ]
|
||||||
|
[ "${capture[3]}" = "git-stub -c user.name=Test Suite -c user.email=test@github.com commit -m Commit Message --author=Test Suite <test@users.noreply.github.com> --force" ]
|
||||||
|
[ "${capture[4]}" = "git-stub push --set-upstream origin HEAD:master --tags" ]
|
||||||
|
|
||||||
# shellmock_verify
|
# Failed Exit Code
|
||||||
# [ "${capture[0]}" = '-c user.name="${INPUT_COMMIT_USER_NAME}"' ]
|
[ "$status" -ne 0 ]
|
||||||
# [ "${capture[1]}" = "some-stub2 arg1 arg2" ]
|
|
||||||
|
|
||||||
|
|
||||||
[ "$status" -eq 0 ]
|
|
||||||
[ "${lines[0]}" = "INPUT_REPOSITORY value: ${INPUT_REPOSITORY}" ]
|
[ "${lines[0]}" = "INPUT_REPOSITORY value: ${INPUT_REPOSITORY}" ]
|
||||||
[ "${lines[1]}" = "::set-output name=changes_detected::true" ]
|
[ "${lines[1]}" = "::set-output name=changes_detected::true" ]
|
||||||
[ "${lines[2]}" = "INPUT_BRANCH value: master" ]
|
[ "${lines[2]}" = "INPUT_BRANCH value: master" ]
|
||||||
[ "${lines[3]}" = "Already on 'master'" ]
|
[ "${lines[3]}" = "INPUT_FILE_PATTERN: ." ]
|
||||||
[ "${lines[4]}" = "INPUT_FILE_PATTERN: ." ]
|
[ "${lines[4]}" = "INPUT_COMMIT_OPTIONS: --force" ]
|
||||||
# [ "${lines[2]}" = "INPUT_BRANCH value: master" ]
|
[ "${lines[5]}" = "::debug::Apply commit options --force" ]
|
||||||
# [ "${lines[2]}" = "INPUT_BRANCH value: master" ]
|
|
||||||
# [ "$output" = "Working tree clean. Nothing to commit." ]
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue