aboutsummaryrefslogtreecommitdiff
path: root/brokenlinks/brokenlinks_test.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2025-06-17 23:49:18 +0700
committerShulhan <ms@kilabit.info>2025-06-17 23:49:18 +0700
commit5ac82928702a0f0a7be0ef6e96ab04c39a7e8e9d (patch)
treed323dafb9698ee3b28a68cac4cb9f57239bd0ba1 /brokenlinks/brokenlinks_test.go
parent02ff261893e3b27ba6400973cc3202042a8f3f91 (diff)
downloadjarink-5ac82928702a0f0a7be0ef6e96ab04c39a7e8e9d.tar.xz
brokenlinks: add test cases for IgnoreStatus options
There are two test cases, one for invalid status code like "abc", and one for unknown status code like "50".
Diffstat (limited to 'brokenlinks/brokenlinks_test.go')
-rw-r--r--brokenlinks/brokenlinks_test.go18
1 files changed, 15 insertions, 3 deletions
diff --git a/brokenlinks/brokenlinks_test.go b/brokenlinks/brokenlinks_test.go
index f52cde9..6feb1e2 100644
--- a/brokenlinks/brokenlinks_test.go
+++ b/brokenlinks/brokenlinks_test.go
@@ -112,7 +112,7 @@ func testInsecureServer(fshandle http.Handler) {
}
}
-func TestBrokenlinks(t *testing.T) {
+func TestScan(t *testing.T) {
var testUrl = `http://` + testAddress
type testCase struct {
@@ -134,6 +134,18 @@ func TestBrokenlinks(t *testing.T) {
}, {
opts: brokenlinks.Options{
Url: testUrl,
+ IgnoreStatus: "abc",
+ },
+ expError: `Scan: Options: invalid status code "abc"`,
+ }, {
+ opts: brokenlinks.Options{
+ Url: testUrl,
+ IgnoreStatus: "50",
+ },
+ expError: `Scan: Options: unknown status code "50"`,
+ }, {
+ opts: brokenlinks.Options{
+ Url: testUrl,
IgnoreStatus: `403`,
Insecure: true,
},
@@ -214,9 +226,9 @@ func TestBrokenlinks(t *testing.T) {
}
}
-// Test running Brokenlinks with file PastResultFile is set.
+// Test scanning with [Options.PastResultFile] is set.
// The PastResultFile is modified to only report errors on "/page2".
-func TestBrokenlinks_pastResult(t *testing.T) {
+func TestScan_pastResult(t *testing.T) {
var testUrl = `http://` + testAddress
type testCase struct {