From dd09992347360ab29060aedd33c261410bb94449 Mon Sep 17 00:00:00 2001 From: Doron Zavelevsky Date: Wed, 9 Aug 2023 15:40:02 +0300 Subject: [PATCH] added a test --- tests/ChainCache.spec.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/ChainCache.spec.ts b/tests/ChainCache.spec.ts index 92dd51e..6d65a69 100644 --- a/tests/ChainCache.spec.ts +++ b/tests/ChainCache.spec.ts @@ -151,6 +151,17 @@ describe('ChainCache', () => { const strategies = await cache.getStrategiesByPair('abc', 'xyz'); expect(strategies).to.have.length(1); }); + it('should not contain a strategy after it was deleted', async () => { + const cache = new ChainCache(); + const encodedStrategy1_mod = { + ...encodedStrategy1, + id: BigNumber.from(encodedStrategy1.id.toString()), + }; + cache.addPair('abc', 'xyz', [encodedStrategy1]); + cache.applyBatchedUpdates(10, [], [], [], [encodedStrategy1_mod]); + const strategies = await cache.getStrategiesByPair('abc', 'xyz'); + expect(strategies).to.have.length(0); + }); }); describe('cache miss', () => { it('getStrategiesByPair call miss handler when pair is not cached', async () => {