diff --git a/tests/golden/check-git/check-git.bats b/tests/golden/check-git/check-git.bats new file mode 100644 index 00000000..34a66338 --- /dev/null +++ b/tests/golden/check-git/check-git.bats @@ -0,0 +1,58 @@ +#!/usr/bin/env bats + +# SPDX-FileCopyrightText: 2022 Serokell +# +# SPDX-License-Identifier: MPL-2.0 + +load '../helpers/bats-support/load' +load '../helpers/bats-assert/load' +load '../helpers/bats-file/load' +load '../helpers' + +@test "Git: not a repo" { + cd $TEST_TEMP_DIR + + run xrefcheck + + assert_output --partial "fatal: not a git repository" +} + +@test "Git: file not tracked" { + cd $TEST_TEMP_DIR + + git init + + echo "[a](/a.md)" >> "git.md" + + run xrefcheck + + assert_output --partial "All repository links are valid." +} + +@test "Git: file tracked, check failure" { + cd $TEST_TEMP_DIR + + git init + + echo "[a](./a.md)" >> "git.md" + + git add git.md + + to_temp xrefcheck + + assert_diff - <