Skip to content

Commit f8e8869

Browse files
committed
Fix failing test case when the selected env is Local
1 parent 6d664b2 commit f8e8869

File tree

6 files changed

+11
-7
lines changed

6 files changed

+11
-7
lines changed

packages/bruno-tests/collection/environments/Local.bru

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ vars {
1616
foo: bar
1717
testSetEnvVar: bruno-29653
1818
echo-host: https://echo.usebruno.com
19+
env_name: Local
20+
test_get_env_var_key1: foo
1921
client_id: client_id_1
2022
client_secret: client_secret_1
2123
auth_url: http://localhost:8080/api/auth/oauth2/authorization_code/authorize

packages/bruno-tests/collection/environments/Prod.bru

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,6 @@ vars {
1616
foo: bar
1717
testSetEnvVar: bruno-29653
1818
echo-host: https://echo.usebruno.com
19+
env_name: Prod
20+
test_get_env_var_key1: foo
1921
}

packages/bruno-tests/collection/scripting/api/bru/getEnvName.bru

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ script:pre-request {
1818
tests {
1919
test("should get env name in scripts", function() {
2020
const testEnvName = bru.getVar("testEnvName");
21-
expect(testEnvName).to.equal("Prod");
21+
expect(testEnvName).to.equal(bru.getEnvVar("env_name"));
2222
});
2323
}

packages/bruno-tests/collection/scripting/api/bru/getEnvVar.bru

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,9 @@ get {
1010
auth: none
1111
}
1212

13-
1413
tests {
1514
test("should get env var in scripts", function() {
16-
const host = bru.getEnvVar("host")
17-
expect(host).to.equal("https://testbench-sanity.usebruno.com");
15+
const host = bru.getEnvVar("test_get_env_var_key1")
16+
expect(host).to.equal("foo");
1817
});
19-
}
18+
}

packages/bruno-tests/collection/scripting/api/req/getUrl.bru

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ assert {
1818
tests {
1919
test("req.getUrl()", function() {
2020
const url = req.getUrl();
21-
expect(url).to.equal("https://testbench-sanity.usebruno.com/ping");
21+
expect(url).to.equal(bru.getEnvVar("host") + "/ping");
2222
});
2323
}

packages/bruno-tests/collection/scripting/api/res/getResponseTime.bru

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ tests {
3333
test("res.getResponseTime()", function() {
3434
const responseTime = res.getResponseTime();
3535
expect(typeof responseTime).to.eql("number");
36-
expect(responseTime > 0).to.be.true;
36+
expect(responseTime >= 0).to.be.true;
37+
// 0ms is possible in with local server and CLI run
3738
});
3839

3940
}

0 commit comments

Comments
 (0)