#!/usr/bin/env bats

setup() {
	mkdir -p content/pages/test
	mkdir -p content/users/test
}

@test "Basic choice" {
	echo "---
title: Basic test
---
" > content/pages/test/hop.md

	echo "---
title: Basic choice test
ac_choices:
- \"[abc](/pages/test/home)\"
- \"[def](/pages/test/hop)\"
- \"[ghi](/pages/test/home)\"
---
" > 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 ]
	[ -e content/users/test/test/hop.md ]
}

teardown() {
	rm -rf content/pages/test
	rm -rf content/users/test
}