-
-
Notifications
You must be signed in to change notification settings - Fork 806
Expand file tree
/
Copy pathauthenticationCustomVariable.test.js
More file actions
37 lines (32 loc) · 911 Bytes
/
authenticationCustomVariable.test.js
File metadata and controls
37 lines (32 loc) · 911 Bytes
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
import assert from "node:assert"
import { join } from "desm"
import { BASE_URL } from "../../config.js"
import { setup, teardown } from "../../_testHelpers/index.js"
describe("custom authentication serverless-offline variable tests", function desc() {
beforeEach(() =>
setup({
servicePath: join(import.meta.url),
}),
)
afterEach(() => teardown())
//
;[
{
description:
"should return custom payload from injected authentication provider",
path: "/echo",
status: 200,
},
].forEach(({ description, path, status }) => {
it(description, async () => {
const url = new URL(path, BASE_URL)
const response = await fetch(url)
assert.equal(response.status, status)
const json = await response.json()
assert.deepEqual(
json.event.requestContext.authorizer.lambda.expected,
"it works",
)
})
})
})