-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(nginx): assert 404 on known scraping targets
- Loading branch information
1 parent
a1586a2
commit 08dc906
Showing
1 changed file
with
31 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,31 @@ | ||
const endpoints = ["auth", "cgi", "eligibility/app", "login", "sample/api"]; | ||
const files = [".env", "wp-admin/login.php", "data.json", "secrets/prod.yaml"]; | ||
|
||
const visit = (partial_path) => { | ||
return cy.request({ | ||
method: "GET", | ||
url: `/${partial_path}`, | ||
// allow cypress to continue on 404 | ||
failOnStatusCode: false, | ||
}); | ||
}; | ||
|
||
const NOT_FOUND = 404; | ||
|
||
describe("Scraper filtering spec", () => { | ||
endpoints.forEach((endpoint) => { | ||
it(`404s known scraper endpoint pattern: /${endpoint}`, () => { | ||
visit(endpoint).then((res) => { | ||
expect(res.status).to.eq(NOT_FOUND); | ||
}); | ||
}); | ||
}); | ||
|
||
files.forEach((file) => { | ||
it(`404s known scraper file pattern: /${file}`, () => { | ||
visit(file).then((res) => { | ||
expect(res.status).to.eq(NOT_FOUND); | ||
}); | ||
}); | ||
}); | ||
}); |