acoeur/bin/_commands/count_test.bats
2022-12-12 21:05:06 +01:00

32 lines
723 B
Bash
Executable File

#!/usr/bin/env bats
setup() {
mkdir -p content/users/test
mkdir -p data/users/test
}
@test "Simple count" {
[ ! -e data/users/test/counters.md ]
bin/_commands/count.sh "$(pwd)/content/users/test" count_test.md start.md
[ -e data/users/test/counters.yml ]
[ -e content/users/test/_index.md ]
grep -o "errors: 0" content/users/test/_index.md
grep -o "count_test: 1" data/users/test/counters.yml
bin/_commands/count.sh "$(pwd)/content/users/test" count_test.md
grep -o "count_test: 2" data/users/test/counters.yml
bin/_commands/count.sh "$(pwd)/content/users/test" count_test_2.md
grep -o "count_test_2: 1" data/users/test/counters.yml
}
teardown() {
rm -rf content/users/test
rm -rf data/users/test
}