Files
bruno/packages/bruno-tests/collection/scripting/api/bru/deleteAllEnvVars.bru
sanish chirayath e03cf9a519 Feat/support missing env apis (#7069)
* feat: add support for new variable management functions in Bruno

- Implemented methods to retrieve and delete all environment and global variables.
- Added corresponding translations for new functions in Postman and Bruno converters.
- Updated request handling to include header deletion functionality.
- Enhanced test cases to cover new variable management features.

* feat: add new scripts for environment and global variable management

- Introduced scripts to delete all environment and global variables.
- Added functionality to retrieve all environment and global variables.
- Implemented tests to validate the behavior of new variable management features.

* feat: implement collection variable management in Bruno

- Added methods for managing collection variables: set, get, has, delete, and retrieve all.
- Updated Postman translation functions to reflect new collection variable methods.
- Enhanced tests to validate the functionality of collection variable management.
- Refactored existing code to replace environment variable references with collection variable equivalents.

* feat: enhance collection variable translations in Bruno

- Updated translation functions for collection variable management to align with Postman API.
- Added tests for new collection variable methods: set, has, delete, retrieve all, and clear.
- Refactored existing tests to ensure accurate translation of collection variable operations.

* feat: expand API hints for variable management in Bruno

* fix: test cases

* fix: remove unnecessary return in deleteEnvVar function
2026-02-12 18:38:25 +05:30

36 lines
711 B
Plaintext

meta {
name: deleteAllEnvVars
type: http
seq: 23
}
get {
url: {{host}}/ping
body: none
auth: none
}
script:pre-request {
bru.setEnvVar("testDelAllEnvVar", "to-be-deleted");
}
tests {
const savedEnvVars = bru.getAllEnvVars();
bru.deleteAllEnvVars();
test("should delete all env vars", function() {
const val = bru.getEnvVar("testDelAllEnvVar");
expect(val).to.be.undefined;
});
test("should preserve env name after deleting all vars", function() {
const envName = bru.getEnvName();
expect(envName).to.equal("Prod");
});
// Restore env vars for subsequent requests
for (const [key, value] of Object.entries(savedEnvVars)) {
bru.setEnvVar(key, value);
}
}