Skip to content

Commit

Permalink
Updating http test framework, adding CORS test
Browse files Browse the repository at this point in the history
  • Loading branch information
avoidwork committed Oct 12, 2021
1 parent 8881ce6 commit 9f53973
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"jsonwebtoken": "^8.5.1",
"mocha": "^9.1.2",
"nyc": "^15.1.0",
"tiny-httptest": "^1.1.1"
"tiny-httptest": "^2.0.0"
},
"keywords": [
"rest",
Expand Down
12 changes: 12 additions & 0 deletions test/auth_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,18 @@ describe("Local", function () {
.end();
});

it("POST /auth/login - redirects to a predetermined URI (CORS)", function () {
return tinyhttptest({url: "http://localhost:" + port + login, method: "post"})
.cors("http://not.localhost")
.cookies()
.reuseHeader(csrf)
.json({username: "test", password: valid})
.expectStatus(302)
.expectHeader("content-type", undefined)
.expectHeader("location", "/")
.end();
});

it("GET /uuid (session) - returns a version 4 uuid", function () {
return tinyhttptest({url: "http://localhost:" + port + "/uuid"})
.cookies()
Expand Down

0 comments on commit 9f53973

Please sign in to comment.