77 lines
1.5 KiB
Bash
Executable File
77 lines
1.5 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/pages/test/simple_link_test.md
|
|
|
|
mkdir content/users/test/test
|
|
cp content/pages/test/simple_link_test.md content/users/test/test
|
|
|
|
bin/ac_route.sh "$(pwd)/content/users/test/test" simple_link_test.md
|
|
|
|
[ -e content/users/test/test/simple_link_test.md ]
|
|
}
|
|
|
|
@test "Create file" {
|
|
echo "---
|
|
title: Test file to be created
|
|
---
|
|
" > content/pages/test/to_create.md
|
|
|
|
echo "---
|
|
title: Create test
|
|
ac_create:
|
|
- /pages/test/to_create
|
|
---
|
|
" > content/pages/test/to_create_test.md
|
|
|
|
mkdir content/users/test/test
|
|
cp content/pages/test/to_create_test.md content/users/test/test
|
|
|
|
bin/ac_route.sh "$(pwd)/content/users/test/test" to_create_test.md
|
|
|
|
[ -e content/users/test/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/to_create_test.md
|
|
rm -f content/to_delete_test.md
|
|
rm -f content/to_create.md
|
|
rm -f content/to_delete.md
|
|
}
|