-
Notifications
You must be signed in to change notification settings - Fork 352
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix metadata increment values using actual values to increment by
- Loading branch information
Showing
2 changed files
with
29 additions
and
2 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
packages/node-core/src/indexer/storeCache/cacheMetadata.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors | ||
// SPDX-License-Identifier: GPL-3.0 | ||
|
||
import {CacheMetadataModel} from './cacheMetadata'; | ||
|
||
const incrementKey = 'processedBlockCount'; | ||
|
||
describe('CacheMetadata', () => { | ||
let cacheMetadata: CacheMetadataModel; | ||
|
||
beforeEach(() => { | ||
cacheMetadata = new CacheMetadataModel(null as any); | ||
}); | ||
|
||
// Clearing the cache used to set the setCache and getCache to the same empty object | ||
// The set cache has increment amounts while the get cache has the actual value | ||
it('clears the caches properly', () => { | ||
cacheMetadata.clear(); | ||
|
||
(cacheMetadata as any).getCache[incrementKey] = 100; | ||
|
||
cacheMetadata.setIncrement(incrementKey); | ||
|
||
expect((cacheMetadata as any).setCache[incrementKey]).toBe(1); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters