Skip to content

Commit

Permalink
expand erc721 factory assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike committed Aug 6, 2023
1 parent c4cf6ea commit cbdd209
Show file tree
Hide file tree
Showing 2 changed files with 99 additions and 1 deletion.
1 change: 0 additions & 1 deletion tests/erc-20-pool-factory.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ describe("ERC20PoolFactory assertions", () => {
const expectedCollateralToken = Address.fromString("0x0000000000000000000000000000000000000002")
const expectedQuoteToken = Address.fromString("0x0000000000000000000000000000000000000003")

logStore()
assert.entityCount("Token", 2)

assert.fieldEquals(
Expand Down
99 changes: 99 additions & 0 deletions tests/erc-721-pool-factory.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,103 @@ describe("ERC721PoolFactory assertions", () => {
// More assert options:
// https://thegraph.com/docs/en/developer/matchstick/#asserts
})

test("Factory entity attributes", () => {
assert.entityCount("PoolFactory", 1)

const erc721factoryAddress = Address.fromString("0x0000000000000000000000000000000000002020")
assert.fieldEquals(
"PoolFactory",
erc721factoryAddress.toHexString(),
"poolType",
"ERC721"
)
assert.fieldEquals(
"PoolFactory",
erc721factoryAddress.toHexString(),
"poolCount",
`${ONE_BI}`
)
assert.fieldEquals(
"PoolFactory",
erc721factoryAddress.toHexString(),
"txCount",
`${ONE_BI}`
)
})

test("Pool entity attributes", () => {
assert.entityCount("Pool", 1)

assert.fieldEquals(
"Pool",
"0x0000000000000000000000000000000000000001",
"collateralToken",
"0x0000000000000000000000000000000000000002"
)
assert.fieldEquals(
"Pool",
"0x0000000000000000000000000000000000000001",
"quoteToken",
"0x0000000000000000000000000000000000000003"
)
assert.fieldEquals(
"Pool",
"0x0000000000000000000000000000000000000001",
"lup",
`${MAX_PRICE}`
)
assert.fieldEquals(
"Pool",
"0x0000000000000000000000000000000000000001",
"t0debt",
`${ZERO_BI}`
)
assert.fieldEquals(
"Pool",
"0x0000000000000000000000000000000000000001",
"reserves",
`${ZERO_BI}`
)
assert.fieldEquals(
"Pool",
"0x0000000000000000000000000000000000000001",
"txCount",
`${ZERO_BI}`
)
})

test("Token entity attributes", () => {
const expectedCollateralToken = Address.fromString("0x0000000000000000000000000000000000000002")
const expectedQuoteToken = Address.fromString("0x0000000000000000000000000000000000000003")

assert.entityCount("ERC721Token", 1)
assert.entityCount("Token", 1)

assert.fieldEquals(
"Token",
`${expectedQuoteToken.toHexString()}`,
"name",
"quote"
)
assert.fieldEquals(
"Token",
`${expectedQuoteToken.toHexString()}`,
"symbol",
"Q"
)
assert.fieldEquals(
"ERC721Token",
`${expectedCollateralToken.toHexString()}`,
"name",
"collateral"
)
assert.fieldEquals(
"ERC721Token",
`${expectedCollateralToken.toHexString()}`,
"symbol",
"C"
)
})

})

0 comments on commit cbdd209

Please sign in to comment.