Skip to content

Commit

Permalink
chore: update clarity and clarity-wasm (#1538)
Browse files Browse the repository at this point in the history
  • Loading branch information
hugocaillard authored Aug 9, 2024
1 parent cfdab35 commit 7836efe
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 11 deletions.
12 changes: 6 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
;; counter contract
(define-data-var count uint u0)
(define-map participants principal bool)

Expand Down
20 changes: 15 additions & 5 deletions components/clarinet-sdk/node/tests/simnet-usage.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ describe("basic simnet interactions", () => {
});
it("can not mine empty stacks block in pre-3.0", () => {
expect(() => simnet.mineEmptyStacksBlock()).toThrowError(
"use mineEmptyBurnBlock in epoch lower than 3.0"
"use mineEmptyBurnBlock in epoch lower than 3.0",
);
})
});

it("exposes devnet stacks accounts", () => {
const accounts = simnet.getAccounts();
Expand Down Expand Up @@ -101,8 +101,8 @@ describe("simnet epoch 3", () => {
simnet.mineEmptyBurnBlocks(4);
expect(simnet.burnBlockHeight).toBe(burnBlockHeight + 4);
expect(simnet.stacksBlockHeight).toBe(blockHeight + 9);
})
})
});
});
describe("simnet can run arbitrary snippets", () => {
it("can run simple snippets", () => {
const res = simnet.execute("(+ 1 2)");
Expand Down Expand Up @@ -292,7 +292,7 @@ describe("simnet can get contracts info and deploy contracts", () => {

it("can get contract source", () => {
const counterSource = simnet.getContractSource(`${deployerAddr}.counter`);
expect(counterSource?.startsWith("(define-data-var count")).toBe(true);
expect(counterSource?.startsWith(";; counter contract")).toBe(true);

const counterSourceShortAddr = simnet.getContractSource("counter");
expect(counterSourceShortAddr).toBe(counterSource);
Expand All @@ -311,6 +311,16 @@ describe("simnet can get contracts info and deploy contracts", () => {
expect(getWithShortAddr).toBeDefined();
});

it("can get commets in ast", () => {
const counterAst = simnet.getContractAST(`${deployerAddr}.counter`);

expect(counterAst).toBeDefined();
expect(counterAst.expressions).toHaveLength(11);

// @ts-ignore
expect(counterAst.expressions[0].pre_comments[0][0]).toBe("counter contract");
});

it("can deploy contracts as snippets", () => {
const res = simnet.deployContract("temp", "(+ 24 18)", null, deployerAddr);
expect(res.result).toStrictEqual(Cl.int(42));
Expand Down

0 comments on commit 7836efe

Please sign in to comment.