relay function test -f spec.yaml
--- FAIL: (0.115s)
Error: "bye-bye" does not contain "hello"
Messages: response.bodyContains does not match
FAIL
spec.yaml 0.570s
Spec file reference (full example)
version: "v1"
filename: spec_func.lua # Location of the function file
driver: lua
tests:
- name: standard request # Test case (you can define multiple test cases)
request:
method: PUT
body: |
{
"user": "john"
}
header:
foo: bar
expect:
request:
modified: true # Is true when any of the fields get modified
# Body checks
bodyModified: true
bodyContains: "some"
bodyEquals: "something new"
# Header
headerModified: true
headerEquals:
Authorization: "Bearer xyz"
# Method check
methodModified: true
methodEquals: POST
# Request path checks
pathModified: false
pathEquals: /some/path
pathContains: /users
# Query args (e.g. ?foo=bar)
queryModified: true
queryContains: foo=bar
response:
bodyContains: "hello"