-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix typos * feat: add maxMemoryBlockCount option * tests: add max-memory-block-count test * remove extra re-insert block
- Loading branch information
Showing
8 changed files
with
57 additions
and
14 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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,20 @@ | ||
import { afterAll, describe, expect, it } from 'vitest' | ||
import networks from './networks' | ||
|
||
describe('max-memory-block-count', async () => { | ||
const acala = await networks.acala({ maxMemoryBlockCount: 2 }) | ||
const { chain } = acala | ||
|
||
afterAll(async () => { | ||
await acala.teardown() | ||
}) | ||
|
||
it('removes the oldest block when exceed', async () => { | ||
// ensure the first block is registered | ||
const firstBlock = await chain.getBlockAt(chain.head.number) | ||
await acala.dev.newBlock({ count: 2 }) | ||
const blocksInMemory = chain.blocksInMemory() | ||
expect(blocksInMemory[0].number).toEqual((firstBlock?.number || 0) + 1) | ||
expect(blocksInMemory.length).toEqual(2) | ||
}) | ||
}) |
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