acoeur/bin/_commands/choice_test.bats

40 lines
823 B
Plaintext
Raw Permalink Normal View History

2022-10-26 23:12:29 +02:00
#!/usr/bin/env bats
setup() {
2022-11-05 22:23:24 +01:00
mkdir -p content/pages/test
2022-10-26 23:12:29 +02:00
mkdir -p content/users/test
}
@test "Basic choice" {
echo "---
title: Basic test
---
2022-11-05 22:23:24 +01:00
" > content/pages/test/hop.md
2022-10-26 23:12:29 +02:00
echo "---
title: Basic choice test
ac_choices:
2022-11-05 22:23:24 +01:00
- \"[abc](/pages/test/home)\"
- \"[def](/pages/test/hop)\"
- \"[ghi](/pages/test/home)\"
2022-10-26 23:12:29 +02:00
---
" > content/users/test/choice_test.md
echo "ac_choice=1" > content/users/test/choice_test.choice
[ -e content/users/test/choice_test.md ]
[ -e content/users/test/choice_test.choice ]
bin/ac_route.sh "$(pwd)/content/users/test" choice_test.choice
[ ! -e content/users/test/choice_test.md ]
[ ! -e content/users/test/choice_test.choice ]
[ -e content/users/test/choice_test.result ]
2022-11-05 22:23:24 +01:00
[ -e content/users/test/test/hop.md ]
2022-10-26 23:12:29 +02:00
}
teardown() {
2022-11-05 22:23:24 +01:00
rm -rf content/pages/test
2022-10-26 23:38:40 +02:00
rm -rf content/users/test
2022-10-26 23:12:29 +02:00
}