Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
janjakubnanista committed Nov 21, 2023
1 parent 1898c46 commit 3b16483
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions packages/utils-evm/test/oapp.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { Contract } from "@ethersproject/contracts"
import { EndpointId } from "@layerzerolabs/lz-definitions"
import { expect } from "chai"
import { describe } from "mocha"
import sinon from "sinon"
import { createSetPeerConfigurable } from "../src/oapp"
import { isMisconfigured } from "../src/configurable"

describe("oapp", () => {
describe("createSetPeerConfigurable", () => {
it("should return Configured if the current and desired values match", async () => {
const oapp = {
peers: sinon.stub().resolves("peer-not-set"),
setPeer: sinon.stub().resolves("okay"),
}
const configurable = createSetPeerConfigurable((_, endpointId) => `peer-on-${endpointId}`)
const state = await configurable(oapp as unknown as Contract, EndpointId.AAVEGOTCHI_TESTNET)

expect(isMisconfigured(state)).to.be.true
expect(state.value).to.eql("peer-not-set")
expect(state.desiredValue).to.eql(`peer-on-${EndpointId.AAVEGOTCHI_TESTNET}`)

const result = await state.configure?.()

expect(result).to.eql("okay")
})
})
})

0 comments on commit 3b16483

Please sign in to comment.