|
|
@ -4,26 +4,24 @@ import { createCode, createData } from "../contracts/main"; |
|
|
|
import { randomAddress } from "./utils"; |
|
|
|
import { randomAddress } from "./utils"; |
|
|
|
|
|
|
|
|
|
|
|
describe("Counter tests", () => { |
|
|
|
describe("Counter tests", () => { |
|
|
|
it("should run getter counter() and get counter value", async () => { |
|
|
|
let contract: SmartContract; |
|
|
|
const contract = await SmartContract.fromCell( |
|
|
|
|
|
|
|
|
|
|
|
beforeEach(async () => { |
|
|
|
|
|
|
|
contract = await SmartContract.fromCell( |
|
|
|
createCode(), |
|
|
|
createCode(), |
|
|
|
createData({ |
|
|
|
createData({ |
|
|
|
ownerAddress: randomAddress(0, "seed1"), |
|
|
|
ownerAddress: randomAddress(0, "seed1"), |
|
|
|
counter: 17, |
|
|
|
counter: 17, |
|
|
|
}) |
|
|
|
}) |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it("should run getter counter() and get counter value", async () => { |
|
|
|
const call = await contract.invokeGetMethod("counter", []); |
|
|
|
const call = await contract.invokeGetMethod("counter", []); |
|
|
|
expect(call.result[0].toNumber()).to.equal(17); |
|
|
|
expect(call.result[0].toNumber()).to.equal(17); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
it("should run getter meaning_of_life()", async () => { |
|
|
|
it("should run getter meaning_of_life()", async () => { |
|
|
|
const contract = await SmartContract.fromCell( |
|
|
|
|
|
|
|
createCode(), |
|
|
|
|
|
|
|
createData({ |
|
|
|
|
|
|
|
ownerAddress: randomAddress(0, "seed1"), |
|
|
|
|
|
|
|
counter: 17, |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
const call = await contract.invokeGetMethod("meaning_of_life", []); |
|
|
|
const call = await contract.invokeGetMethod("meaning_of_life", []); |
|
|
|
expect(call.result[0].toNumber()).to.equal(42); |
|
|
|
expect(call.result[0].toNumber()).to.equal(42); |
|
|
|
}); |
|
|
|
}); |
|
|
|