Closed aleeusgr closed 10 months ago
scoped variables and scoped helper functions can provide re-usability in setup, and also cleaner/ modular setup code
describe("vesting contract", () => {
let vestingProgram, initiatorWallet, recipientWallet;
beforeEach(() => {
vestingProgram = new helios.Program( ... );
...
})
it ("tests things while reusing provided `vestingProgram`", async () => {
...
})
})
I'll suggest starting a lightweight outline of testable expectations.
Formatting test files using that kind of outline provides good organization and structure for the testing code.
outline in test DSL:
describe("vesting contract"), () => {
describe("contract initiation", () => {
it("holds assets for vesting", async() => {
})
it("lets the initiator take their own funds back, until the contract is claimed", async () => {})
})
describe("contract claim", async() => {
it("allows the recipient to mint a claim token they can hold in their wallet" async() => {
})
it("doesn't let the initiator withdraw funds once claimed", async() => {
})
})
describe("gradual maturation", () => {
...
})
describe("reclaiming funds after long period of inactivity" () => {
...
})
})