mirror of
https://github.com/usebruno/bruno.git
synced 2024-12-13 02:01:01 +01:00
33 lines
576 B
Plaintext
33 lines
576 B
Plaintext
|
meta {
|
||
|
name: setTimeout
|
||
|
type: http
|
||
|
seq: 1
|
||
|
}
|
||
|
|
||
|
get {
|
||
|
url: {{host}}/ping
|
||
|
body: none
|
||
|
auth: none
|
||
|
}
|
||
|
|
||
|
script:pre-request {
|
||
|
bru.setVar("test-js-set-timeout", "");
|
||
|
await new Promise((resolve, reject) => {
|
||
|
setTimeout(() => {
|
||
|
bru.setVar("test-js-set-timeout", "bruno");
|
||
|
resolve();
|
||
|
}, 1000);
|
||
|
});
|
||
|
|
||
|
const v = bru.getVar("test-js-set-timeout");
|
||
|
bru.setVar("test-js-set-timeout", v + "-is-awesome");
|
||
|
|
||
|
}
|
||
|
|
||
|
tests {
|
||
|
test("setTimeout()", function() {
|
||
|
const v = bru.getVar("test-js-set-timeout")
|
||
|
expect(v).to.eql("bruno-is-awesome");
|
||
|
});
|
||
|
}
|