Skip to content

Commit

Permalink
added a test
Browse files Browse the repository at this point in the history
  • Loading branch information
zavelevsky committed Aug 9, 2023
1 parent e16836c commit dd09992
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/ChainCache.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down

0 comments on commit dd09992

Please sign in to comment.