-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: updated testbench - primitive data types (#2888)
* fix: getRequestVar shim, boolean values in vm * chore: updated testbench
- Loading branch information
Showing
1 changed file
with
54 additions
and
0 deletions.
There are no files selected for viewing
54 changes: 54 additions & 0 deletions
54
packages/bruno-tests/collection/scripting/js/data types.bru
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,54 @@ | ||
meta { | ||
name: data types | ||
type: http | ||
seq: 2 | ||
} | ||
|
||
post { | ||
url: {{host}}/api/echo/json | ||
body: json | ||
auth: none | ||
} | ||
|
||
body:json { | ||
{ | ||
"boolean": false, | ||
"number": 1, | ||
"string": "bruno", | ||
"array": [1, 2, 3, 4, 5], | ||
"object": { | ||
"hello": "bruno" | ||
}, | ||
"null": null | ||
} | ||
} | ||
|
||
script:pre-request { | ||
const reqBody = req.getBody(); | ||
|
||
bru.setVar("dataTypeVarTest", { | ||
...reqBody, | ||
"undefined": undefined | ||
}); | ||
} | ||
|
||
tests { | ||
test("data types check via bru var", function() { | ||
let v = bru.getVar("dataTypeVarTest"); | ||
v = { | ||
...v, | ||
"undefined": undefined | ||
}; | ||
expect(v).to.eql({ | ||
"boolean": false, | ||
"number": 1, | ||
"string": "bruno", | ||
"array": [1, 2, 3, 4, 5], | ||
"object": { | ||
"hello": "bruno" | ||
}, | ||
"null": null, | ||
"undefined": undefined | ||
}) | ||
}); | ||
} |