mirror of
https://github.com/usebruno/bruno.git
synced 2026-06-11 09:51:30 +00:00
fix: variables set via setVar should be interpolated only during runtime
This commit is contained in:
@@ -230,7 +230,7 @@ class Bru {
|
||||
);
|
||||
}
|
||||
|
||||
this.runtimeVariables[key] = this.interpolate(value);
|
||||
this.runtimeVariables[key] = value;
|
||||
}
|
||||
|
||||
getVar(key) {
|
||||
|
||||
@@ -248,14 +248,14 @@ describe('runtime', () => {
|
||||
});
|
||||
|
||||
describe('bru.setVar random variable', () => {
|
||||
it('should not be equal to {{$randomFirstName}}', async () => {
|
||||
it('should be able to set random variables as values', async () => {
|
||||
const script = `bru.setVar('title', '{{$randomFirstName}}')`;
|
||||
|
||||
const runtime = new ScriptRuntime({ runtime: 'nodevm' });
|
||||
|
||||
const result = await runtime.runRequestScript(script, {}, {}, {}, '.', null, process.env);
|
||||
|
||||
expect(result.runtimeVariables.title).not.toBe('{{$randomFirstName}}');
|
||||
expect(result.runtimeVariables.title).toBe('{{$randomFirstName}}');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user