Main.spec.ts 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import { Blockchain, SandboxContract, TreasuryContract } from "@ton/sandbox";
  2. import { Cell, toNano } from "@ton/core";
  3. import { Main, MainConfig } 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. const config: MainConfig = {
  17. singleUpdateFee: 0,
  18. dataSources: [],
  19. guardianSetIndex: 0,
  20. guardianSet: [],
  21. chainId: 0,
  22. governanceChainId: 0,
  23. governanceContract:
  24. "0000000000000000000000000000000000000000000000000000000000000000",
  25. governanceDataSource: {
  26. emitterChain: 0,
  27. emitterAddress:
  28. "0000000000000000000000000000000000000000000000000000000000000000",
  29. },
  30. };
  31. main = blockchain.openContract(Main.createFromConfig(config, code));
  32. deployer = await blockchain.treasury("deployer");
  33. const deployResult = await main.sendDeploy(
  34. deployer.getSender(),
  35. toNano("0.05")
  36. );
  37. expect(deployResult.transactions).toHaveTransaction({
  38. from: deployer.address,
  39. to: main.address,
  40. deploy: true,
  41. success: true,
  42. });
  43. });
  44. it("should deploy", async () => {
  45. // the check is done inside beforeEach
  46. // blockchain and main are ready to use
  47. });
  48. });