-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(store): add examples to unit test entity store (#1136)
- Loading branch information
1 parent
c0bb4cc
commit 3421b93
Showing
2 changed files
with
20 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,31 @@ | ||
import assert from 'assert' | ||
import { before, describe, test } from 'node:test' | ||
import { TestProcessorServer } from '@sentio/sdk/testing' | ||
import { mockTransferLog } from '@sentio/sdk/eth/builtin/erc20' | ||
import { User } from './schema/schema.js' | ||
|
||
describe('Test Processor', () => { | ||
const service = new TestProcessorServer(async () => await import('./processor.js')) | ||
const server = new TestProcessorServer(async () => await import('./processor.js')) | ||
|
||
before(async () => { | ||
await service.start() | ||
await server.start() | ||
}) | ||
|
||
test('has config', async () => { | ||
const config = await service.getConfig({}) | ||
const config = await server.getConfig({}) | ||
assert(config.contractConfigs.length > 0) | ||
}) | ||
|
||
test('data is upsert', async () => { | ||
await server.eth.testLog( | ||
mockTransferLog('0x1e4ede388cbc9f4b5c79681b7f94d36a11abebc9', { | ||
from: '0x0000000000000000000000000000000000000000', | ||
to: '0xb329e39ebefd16f40d38f07643652ce17ca5bac1', | ||
value: 10n ** 18n * 10n | ||
}) | ||
) | ||
|
||
const from = await server.store.list(User) | ||
assert(from.length == 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