-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
234 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# SPDX-FileCopyrightText: 2022 Serokell <https://serokell.io> | ||
# | ||
# SPDX-License-Identifier: Unlicense | ||
|
||
scanners: | ||
markdown: | ||
flavor: GitHub | ||
|
||
networking: | ||
externalRefRedirects: | ||
- outcome: valid | ||
to: ^.*$ | ||
on: 404 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# SPDX-FileCopyrightText: 2022 Serokell <https://serokell.io> | ||
# | ||
# SPDX-License-Identifier: Unlicense | ||
|
||
scanners: | ||
markdown: | ||
flavor: GitHub | ||
|
||
networking: | ||
externalRefRedirects: | ||
- outcome: valid | ||
to: ^.*$ | ||
on: premanent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# SPDX-FileCopyrightText: 2022 Serokell <https://serokell.io> | ||
# | ||
# SPDX-License-Identifier: Unlicense | ||
|
||
scanners: | ||
markdown: | ||
flavor: GitHub | ||
|
||
networking: | ||
externalRefRedirects: | ||
- outcome: flow |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# SPDX-FileCopyrightText: 2022 Serokell <https://serokell.io> | ||
# | ||
# SPDX-License-Identifier: Unlicense | ||
|
||
scanners: | ||
markdown: | ||
flavor: GitHub | ||
|
||
networking: | ||
externalRefRedirects: [Bad] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# SPDX-FileCopyrightText: 2022 Serokell <https://serokell.io> | ||
# | ||
# SPDX-License-Identifier: Unlicense | ||
|
||
scanners: | ||
markdown: | ||
flavor: GitHub | ||
|
||
networking: | ||
externalRefRedirects: Bad |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# SPDX-FileCopyrightText: 2022 Serokell <https://serokell.io> | ||
# | ||
# SPDX-License-Identifier: Unlicense | ||
|
||
scanners: | ||
markdown: | ||
flavor: GitHub | ||
|
||
networking: | ||
externalRefRedirects: | ||
- outcome: valid | ||
to: 42 |
93 changes: 93 additions & 0 deletions
93
tests/golden/check-redirect-parse/check-redirect-parse.bats
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
#!/usr/bin/env bats | ||
|
||
# SPDX-FileCopyrightText: 2022 Serokell <https://serokell.io> | ||
# | ||
# SPDX-License-Identifier: MPL-2.0 | ||
|
||
load '../helpers/bats-support/load' | ||
load '../helpers/bats-assert/load' | ||
load '../helpers/bats-file/load' | ||
load '../helpers' | ||
|
||
|
||
@test "No redirect rules" { | ||
to_temp xrefcheck -c no-rules.yaml | ||
|
||
assert_diff - <<EOF | ||
All repository links are valid. | ||
EOF | ||
} | ||
|
||
@test "Only outcome" { | ||
to_temp xrefcheck -c only-outcome.yaml | ||
|
||
assert_diff - <<EOF | ||
All repository links are valid. | ||
EOF | ||
} | ||
|
||
@test "Only outcome and to" { | ||
to_temp xrefcheck -c only-outcome-to.yaml | ||
|
||
assert_diff - <<EOF | ||
All repository links are valid. | ||
EOF | ||
} | ||
|
||
@test "Only outcome and on" { | ||
to_temp xrefcheck -c only-outcome-to.yaml | ||
|
||
assert_diff - <<EOF | ||
All repository links are valid. | ||
EOF | ||
} | ||
|
||
@test "Full rule" { | ||
to_temp xrefcheck -c full-rule.yaml | ||
|
||
assert_diff - <<EOF | ||
All repository links are valid. | ||
EOF | ||
} | ||
|
||
@test "Rules not an array error" { | ||
run xrefcheck -c bad-rules.yaml | ||
|
||
assert_output --partial "expected Array, but encountered String" | ||
} | ||
|
||
@test "Rule not an object error" { | ||
run xrefcheck -c bad-rule.yaml | ||
|
||
assert_output --partial "expected Object, but encountered String" | ||
} | ||
|
||
@test "Bad code error" { | ||
run xrefcheck -c bad-code.yaml | ||
|
||
assert_output --partial "expected a redirect (3XX) HTTP code or (permanent|temporary)" | ||
} | ||
|
||
@test "Bad on" { | ||
run xrefcheck -c bad-on.yaml | ||
|
||
assert_output --partial "expected a redirect (3XX) HTTP code or (permanent|temporary)" | ||
} | ||
|
||
@test "Bad to" { | ||
run xrefcheck -c bad-to.yaml | ||
|
||
assert_output --partial "expected String, but encountered Number" | ||
} | ||
|
||
@test "Bad outcome" { | ||
run xrefcheck -c bad-outcome.yaml | ||
|
||
assert_output --partial "expected (valid|invalid|follow)" | ||
} | ||
|
||
@test "No outcome error" { | ||
run xrefcheck -c no-outcome.yaml | ||
|
||
assert_output --partial "key \"outcome\" not found" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# SPDX-FileCopyrightText: 2022 Serokell <https://serokell.io> | ||
# | ||
# SPDX-License-Identifier: Unlicense | ||
|
||
scanners: | ||
markdown: | ||
flavor: GitHub | ||
|
||
networking: | ||
externalRefRedirects: | ||
- outcome: valid | ||
to: ^https://.*$ | ||
on: permanent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# SPDX-FileCopyrightText: 2022 Serokell <https://serokell.io> | ||
# | ||
# SPDX-License-Identifier: Unlicense | ||
|
||
scanners: | ||
markdown: | ||
flavor: GitHub | ||
|
||
networking: | ||
externalRefRedirects: | ||
- outcome: valid | ||
on: temporary | ||
- to: ^https://.*$ | ||
on: temporary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# SPDX-FileCopyrightText: 2022 Serokell <https://serokell.io> | ||
# | ||
# SPDX-License-Identifier: Unlicense | ||
|
||
scanners: | ||
markdown: | ||
flavor: GitHub | ||
|
||
networking: | ||
externalRefRedirects: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# SPDX-FileCopyrightText: 2022 Serokell <https://serokell.io> | ||
# | ||
# SPDX-License-Identifier: Unlicense | ||
|
||
scanners: | ||
markdown: | ||
flavor: GitHub | ||
|
||
networking: | ||
externalRefRedirects: | ||
- outcome: invalid | ||
on: 302 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# SPDX-FileCopyrightText: 2022 Serokell <https://serokell.io> | ||
# | ||
# SPDX-License-Identifier: Unlicense | ||
|
||
scanners: | ||
markdown: | ||
flavor: GitHub | ||
|
||
networking: | ||
externalRefRedirects: | ||
- outcome: valid | ||
to: ^https://.*$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# SPDX-FileCopyrightText: 2022 Serokell <https://serokell.io> | ||
# | ||
# SPDX-License-Identifier: Unlicense | ||
|
||
scanners: | ||
markdown: | ||
flavor: GitHub | ||
|
||
networking: | ||
externalRefRedirects: | ||
- outcome: follow |