mirror of
https://github.com/usebruno/bruno.git
synced 2025-01-24 22:58:44 +01:00
753a576c3c
Safe Mode Sandbox using QuickJS Co-authored-by: Anoop M D <anoop.md1421@gmail.com> Co-authored-by: lohit <lohit.jiddimani@gmail.com>
27 lines
443 B
Plaintext
27 lines
443 B
Plaintext
meta {
|
|
name: nanoid
|
|
type: http
|
|
seq: 1
|
|
}
|
|
|
|
get {
|
|
url: {{host}}/ping
|
|
body: none
|
|
auth: none
|
|
}
|
|
|
|
script:pre-request {
|
|
const { nanoid } = require("nanoid");
|
|
|
|
bru.setVar("nanoid-test-id", nanoid());
|
|
}
|
|
|
|
tests {
|
|
test("nanoid var", function() {
|
|
const id = bru.getVar('nanoid-test-id');
|
|
let isValidNanoid = /^[a-zA-Z0-9_-]{21}$/.test(id)
|
|
bru.setVar('nanoid-test-id', null);
|
|
expect(isValidNanoid).to.eql(true);
|
|
});
|
|
}
|