/
test
52 lines (40 loc) · 2.36 KB
/
test
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# Note, scripted strips quotes that are next to spaces, so that's why all string literals are in parenthesis, even
# when unnecessary.
# Initially should fail because there's a link to a page which doesn't exist
-> paradoxValidateInternalLinks
# Add the path, but without the fragment, so validation still fails
> set additionalInternalMappings := List(file("withoutfragment.html") -> ("test.html"))
-> paradoxValidateInternalLinks
# Now add the path with the fragment, validation should succeed
> set additionalInternalMappings := List(file("withfragment.html") -> ("test.html"))
> paradoxValidateInternalLinks
# Now set a base path of /, validation should fail due to /../outside.html not existing
> set paradoxValidationSiteBasePath := Some("/")
-> paradoxValidateInternalLinks
# Now set the base path to /docs, validation should still fail due to /outside.html not existing
> set paradoxValidationSiteBasePath := Some("/docs")
-> paradoxValidateInternalLinks
# Now add an /outside.html, but without a fragment, validation should fail
> set additionalMappings := List(file("withoutfragment.html") -> ("/outside.html"))
-> paradoxValidateInternalLinks
# Now add an /outside.html, with a fragment, validation should succeed
> set additionalMappings := List(file("withfragment.html") -> ("/outside.html"))
> paradoxValidateInternalLinks
# Also try setting the internal link with an absolute path
> set additionalInternalMappings := Nil
> set additionalMappings += (file("withfragment.html") -> ("/docs/test.html"))
> paradoxValidateInternalLinks
# Finally, try validating external links, first check that it fails
-> paradoxValidateLinks
# Now make sure it fails when just the 404ing link is ignored
> set paradoxValidationIgnorePaths := List(".*thisrepodoesnotexist.*".r)
-> paradoxValidateLinks
# Now make sure it fails when just the 401ing link is ignored
> set paradoxValidationIgnorePaths := List("https://lightbend.com".r)
-> paradoxValidateLinks
# Now ignore both failing links, and it should pass. Note though that passing depends on GitHub being up,
# since there is a valid link that points to GitHub. If we're running in CI, GitHub being up is an alright
# assumption to make, given that GitHub triggered the build, and will have to be up to receive the status
# report
> set paradoxValidationIgnorePaths := List("https://lightbend.com".r, (".*thisrepodoesnotexist.*").r)
> paradoxValidateLinks