Main.spec.ts 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import { Blockchain, SandboxContract, TreasuryContract } from "@ton/sandbox";
  2. import { Cell, toNano } from "@ton/core";
  3. import { Main } from "../wrappers/Main";
  4. import "@ton/test-utils";
  5. import { compile } from "@ton/blueprint";
  6. describe("Main", () => {
  7. let code: Cell;
  8. beforeAll(async () => {
  9. code = await compile("Main");
  10. });
  11. let blockchain: Blockchain;
  12. let deployer: SandboxContract<TreasuryContract>;
  13. let main: SandboxContract<Main>;
  14. beforeEach(async () => {
  15. blockchain = await Blockchain.create();
  16. main = blockchain.openContract(Main.createFromConfig({}, code));
  17. deployer = await blockchain.treasury("deployer");
  18. const deployResult = await main.sendDeploy(
  19. deployer.getSender(),
  20. toNano("0.05")
  21. );
  22. expect(deployResult.transactions).toHaveTransaction({
  23. from: deployer.address,
  24. to: main.address,
  25. deploy: true,
  26. success: true,
  27. });
  28. });
  29. it("should deploy", async () => {
  30. // the check is done inside beforeEach
  31. // blockchain and main are ready to use
  32. });
  33. });