-
Notifications
You must be signed in to change notification settings - Fork 150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Testing framework: RnD #239
Comments
Mock data sinksMock TypeORM storeUse in-memory sqlite data source (outdated example here) Mock FilestoreDo we need it? Devs can just delete files manually after testing Mock bigqueryI haven't found an easy solution to mock BigQuery. I think best solution here would be to recommend users to use something like https://github.com/goccy/bigquery-emulator and connect to it Mock Batch ProcessorsMockEvmBatchProcessor gets EvmProcessor instance and only cares for what was set in import {handler, processor} from "./src"
import {encodeLog} from "@subsquid/evm-utils"
import * as contract from "./abi/contract.ts"
const tokenAddress = '0x12313123...'
test("Correctly calculates minted amounts", () => {
const mockProcessor = new MockEvmBatchProcessor(processor)
const db = new MockTypeOrm()
mockProcessor.run(db, handler)
// This would wait until handler(ctx) is called
await mockProcessor.inject([{
logs: [
encodeLog(contract.events.Mint, tokenAddress, {
to: ...
amount: 10n
}),
encodeLog(contract.events.Mint, tokenAddress, {
to: ...
amount: 100n
}),
],
}])
expect((await db.get(Token, tokenAddress)).totalSupply).toBe(110n)
}) Similar one for substrate |
Can we generate events from the ABI? |
also not clear how |
Why we can't use a real database? |
Epic: Testing framework for squids #220
Estimate: 2d
The text was updated successfully, but these errors were encountered: