bruno/packages/bruno-tests/collection/scripting/inbuilt modules/uuid/uuid.bru
Anoop M D 753a576c3c
Feat/safe mode quickjs (#2848)
Safe Mode Sandbox using QuickJS
Co-authored-by: Anoop M D <anoop.md1421@gmail.com>
Co-authored-by: lohit <lohit.jiddimani@gmail.com>
2024-08-21 12:52:49 +05:30

27 lines
471 B
Plaintext

meta {
name: uuid
type: http
seq: 1
}
get {
url: {{host}}/ping
body: none
auth: none
}
script:pre-request {
const { v4 } = require("uuid");
bru.setVar("uuid-test-id", v4());
}
tests {
test("uuid var", function() {
const id = bru.getVar('uuid-test-id');
let isValidUuid = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(id);
bru.setVar('uuid-test-id', null);
expect(isValidUuid).to.eql(true);
});
}