mirror of
https://github.com/usebruno/bruno.git
synced 2025-06-21 12:33:34 +02:00
test: expression cache
This commit is contained in:
parent
a4f757ee87
commit
429ca4093c
@ -27,6 +27,20 @@ describe("utils", () => {
|
|||||||
expect(cache.size).toBe(1);
|
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", () => {
|
it("should identify top level variables", () => {
|
||||||
const expr = "res.data.pets[0].toUpperCase()";
|
const expr = "res.data.pets[0].toUpperCase()";
|
||||||
evaluateJsExpression(expr, context);
|
evaluateJsExpression(expr, context);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user