mirror of
https://github.com/Instadapp/fla-fees-subgraph.git
synced 2024-07-29 21:57:15 +00:00
58 lines
1.7 KiB
TypeScript
58 lines
1.7 KiB
TypeScript
import {
|
|
assert,
|
|
describe,
|
|
test,
|
|
clearStore,
|
|
beforeAll,
|
|
afterAll
|
|
} from "matchstick-as/assembly/index"
|
|
import { Address } from "@graphprotocol/graph-ts"
|
|
import { ExampleEntity } from "../generated/schema"
|
|
import { AdminChanged } from "../generated/FLA/FLA"
|
|
import { handleAdminChanged } from "../src/fla"
|
|
import { createAdminChangedEvent } from "./fla-utils"
|
|
|
|
// Tests structure (matchstick-as >=0.5.0)
|
|
// https://thegraph.com/docs/en/developer/matchstick/#tests-structure-0-5-0
|
|
|
|
describe("Describe entity assertions", () => {
|
|
beforeAll(() => {
|
|
let previousAdmin = Address.fromString(
|
|
"0x0000000000000000000000000000000000000001"
|
|
)
|
|
let newAdmin = Address.fromString(
|
|
"0x0000000000000000000000000000000000000001"
|
|
)
|
|
let newAdminChangedEvent = createAdminChangedEvent(previousAdmin, newAdmin)
|
|
handleAdminChanged(newAdminChangedEvent)
|
|
})
|
|
|
|
afterAll(() => {
|
|
clearStore()
|
|
})
|
|
|
|
// For more test scenarios, see:
|
|
// https://thegraph.com/docs/en/developer/matchstick/#write-a-unit-test
|
|
|
|
test("ExampleEntity created and stored", () => {
|
|
assert.entityCount("ExampleEntity", 1)
|
|
|
|
// 0xa16081f360e3847006db660bae1c6d1b2e17ec2a is the default address used in newMockEvent() function
|
|
assert.fieldEquals(
|
|
"ExampleEntity",
|
|
"0xa16081f360e3847006db660bae1c6d1b2e17ec2a",
|
|
"previousAdmin",
|
|
"0x0000000000000000000000000000000000000001"
|
|
)
|
|
assert.fieldEquals(
|
|
"ExampleEntity",
|
|
"0xa16081f360e3847006db660bae1c6d1b2e17ec2a",
|
|
"newAdmin",
|
|
"0x0000000000000000000000000000000000000001"
|
|
)
|
|
|
|
// More assert options:
|
|
// https://thegraph.com/docs/en/developer/matchstick/#asserts
|
|
})
|
|
})
|