-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
115 additions
and
11 deletions.
There are no files selected for viewing
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
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
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
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
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
39 changes: 39 additions & 0 deletions
39
packages/bruno-tests/collection/scripting/js/vars asserts.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,39 @@ | ||
meta { | ||
name: vars asserts | ||
type: http | ||
seq: 5 | ||
} | ||
|
||
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 | ||
} | ||
} | ||
|
||
vars:pre-request { | ||
vars_asserts__request_var: vars_asserts__request_var__value | ||
} | ||
|
||
assert { | ||
vars_asserts__request_var: eq vars_asserts__request_var__value | ||
vars_asserts__runtime_var: eq vars_asserts__runtime_var__value | ||
vars_asserts__env_var: eq vars_asserts__env_var__value | ||
} | ||
|
||
script:pre-request { | ||
bru.setVar('vars_asserts__runtime_var', 'vars_asserts__runtime_var__value'); | ||
bru.setEnvVar('vars_asserts__env_var', 'vars_asserts__env_var__value'); | ||
} |
37 changes: 37 additions & 0 deletions
37
packages/bruno-tests/collection/scripting/local modules/invalid and valid module imports.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,37 @@ | ||
meta { | ||
name: invalid and valid module imports | ||
type: http | ||
seq: 3 | ||
} | ||
|
||
get { | ||
url: {{host}}/ping | ||
body: none | ||
auth: none | ||
} | ||
|
||
assert { | ||
invalid_module_error_thrown: eq true | ||
valid_module_no_error: eq true | ||
} | ||
|
||
script:pre-request { | ||
try { | ||
bru.setVar('invalid_module_error_thrown', false); | ||
// should throw an error | ||
const invalid = require("./lib/invalid"); | ||
} | ||
catch(error) { | ||
bru.setVar('invalid_module_error_thrown', true); | ||
} | ||
|
||
|
||
try { | ||
bru.setVar('valid_module_no_error', true); | ||
// should not throw an error | ||
const math = require("./lib/math"); | ||
} | ||
catch(error) { | ||
bru.setVar('valid_module_no_error', false); | ||
} | ||
} |