Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update tests/changelog.bats (fixes #2161) #2162

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
41 changes: 39 additions & 2 deletions tests/changelog.bats
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,47 @@ load test-helper
if [ ! -f "../CHANGELOG.md" ]; then
cp "/usr/lib/node_modules/@treehouses/cli/CHANGELOG.md" ../.
run "${clicmd}" changelog
assert_success
rm "../CHANGELOG.md"
assert_success && rm "../CHANGELOG.md"
else
run "${clicmd}" changelog
assert_success
fi
}

@test "$clinom changelog view" {
[ -e /usr/bin/view ] && [ -e /usr/lib/node_modules/@treehouses/cli/CHANGELOG.md ] # changelog view opens the log file in VIM read-only, this checks if view and changelog exists
assert_success
}

@test "$clinom changelog compare (no version included)" {
if [ ! -f "../CHANGELOG.md" ]; then
cp "/usr/lib/node_modules/@treehouses/cli/CHANGELOG.md" ../.
run "${clicmd}" changelog compare
assert_failure && rm "../CHANGELOG.md"
else
run "${clicmd}" changelog compare
assert_failure
fi
}

@test "$clinom changelog compare old-version (one version provided)" {
if [ ! -f "../CHANGELOG.md" ]; then
cp "/usr/lib/node_modules/@treehouses/cli/CHANGELOG.md" ../.
run "${clicmd}" changelog compare 1.0.0
assert_success && rm "../CHANGELOG.md"
else
run "${clicmd}" changelog compare 1.0.0
assert_success
fi
}

@test "$clinom changelog compare old-version new-version (two versions provided)" {
if [ ! -f "../CHANGELOG.md" ]; then
cp "/usr/lib/node_modules/@treehouses/cli/CHANGELOG.md" ../.
run "${clicmd}" changelog compare 1.0.0 1.0.1
assert_success && rm "../CHANGELOG.md"
else
run "${clicmd}" changelog compare 1.0.0 1.0.1
assert_success
fi
}