acoeur/bin/_commands/default_actions_test.bats
2022-10-26 23:38:40 +02:00

76 lines
1.4 KiB
Bash
Executable File

#!/usr/bin/env bats
setup() {
mkdir -p content/pages/test
mkdir -p content/users/test
}
@test "Simple publication" {
echo "---
title: Simple link test
---
" > content/simple_link_test.md
cp content/simple_link_test.md content/users/test/
bin/ac_route.sh "$(pwd)/content" simple_link_test.md
[ -e content/users/test/simple_link_test.md ]
}
@test "Create file" {
echo "---
title: Test file to be create
---
" > content/to_create.md
echo "---
title: Create test
ac_create:
- to_create
---
" > content/to_create_test.md
cp content/to_create_test.md content/users/test/
bin/ac_route.sh "$(pwd)/content/users/test" to_create_test.md
[ -e content/users/test/to_create.md ]
}
@test "Delete file" {
echo "---
title: Delete test
---
" > content/test.md
cp content/test.md content/users/test/test.md
echo "---
title: Delete test
ac_delete:
- to_delete
---
" > content/to_delete_test.md
cp content/to_delete_test.md content/users/test/
[ -e content/users/test/to_delete_test.md ]
bin/ac_route.sh "$(pwd)/content/users/test" to_delete_test.md
[ -e content/users/test/to_delete_test.md ]
[ ! -e content/users/test/to_delete.md ]
}
teardown() {
rm -f content/test.md
rm -rf content/pages/test
rm -rf content/users/test
rm -f content/simple_link_test.md
rm -f content/to_create_test.md
rm -f content/to_delete_test.md
rm -f content/to_create.md
rm -f content/to_delete.md
}