-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbasic.spec.js
44 lines (38 loc) · 1.22 KB
/
basic.spec.js
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
"use strict"
require("../../test/support/setup")
const path = require("path")
const expect = require("chai").expect
const ServerlessInvoker = require("../../index")
describe("basic", function () {
// in serverless v3 these started taking longer than the default 2000ms
this.timeout(4000)
let sls = null
beforeEach(function () {
sls = new ServerlessInvoker(path.join(__dirname))
})
it("should invoke simple path", function () {
const response = sls.invoke("GET api/hello")
return expect(response).to.eventually.have.property("statusCode", 200)
})
it("should have event.httpMethod", function () {
const response = sls.invoke("GET api/hello")
return expect(response).to.eventually.have.deep.nested.property(
"body.input.httpMethod",
"GET"
)
})
it("should have event.path", function () {
const response = sls.invoke("GET api/hello")
return expect(response).to.eventually.have.deep.nested.property(
"body.input.path",
"/api/hello"
)
})
it("should have event.resource", function () {
const response = sls.invoke("GET api/hello")
return expect(response).to.eventually.have.deep.nested.property(
"body.input.resource",
"/api/hello"
)
})
})