Skip to content

Commit

Permalink
chore: updated testbench - primitive data types (#2888)
Browse files Browse the repository at this point in the history
* fix: getRequestVar shim, boolean values in vm
* chore: updated testbench
  • Loading branch information
lohxt1 authored Aug 22, 2024
1 parent 74e75a7 commit e4407f3
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions packages/bruno-tests/collection/scripting/js/data types.bru
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
})
});
}

0 comments on commit e4407f3

Please sign in to comment.