mirror of
https://github.com/usebruno/bruno.git
synced 2025-02-22 12:41:37 +01:00
test: expression cache
This commit is contained in:
parent
a4f757ee87
commit
429ca4093c
@ -27,6 +27,20 @@ describe("utils", () => {
|
||||
expect(cache.size).toBe(1);
|
||||
});
|
||||
|
||||
it("should use cached expression", () => {
|
||||
const expr = "res.data.pets";
|
||||
|
||||
evaluateJsExpression(expr, context);
|
||||
|
||||
const fn = cache.get(expr);
|
||||
expect(fn).toBeDefined();
|
||||
|
||||
evaluateJsExpression(expr, context);
|
||||
|
||||
// cache should not be overwritten
|
||||
expect(cache.get(expr)).toBe(fn);
|
||||
});
|
||||
|
||||
it("should identify top level variables", () => {
|
||||
const expr = "res.data.pets[0].toUpperCase()";
|
||||
evaluateJsExpression(expr, context);
|
||||
|
Loading…
Reference in New Issue
Block a user