11import { Simnet , tx } from "@hirosystems/clarinet-sdk" ;
22import { describe , it } from "vitest" ;
3- import {
4- extractTestAnnotations ,
5- } from "./parser/clarity-parser" ;
3+ import { extractTestAnnotations } from "./parser/clarity-parser" ;
64import { expectOkTrue , isValidTestFunction } from "./parser/test-helpers" ;
75import { FunctionAnnotations } from "./parser/clarity-parser-flow-tests" ;
86
97/**
108 * Returns true if the contract is a test contract
119 * @param contractName name of the contract
12- * @returns
10+ * @returns
1311 */
1412function isTestContract ( contractName : string ) {
1513 return (
@@ -44,10 +42,11 @@ export function generateUnitTests(simnet: Simnet) {
4442 annotations [ functionName ] || { } ;
4543
4644 const mineBlocksBefore =
47- parseInt ( annotations [ "mine-blocks-before" ] as string ) || 0 ;
45+ parseInt ( functionAnnotations [ "mine-blocks-before" ] as string ) || 0 ;
4846
49- const testDescription = `${ functionCall . name } ${ functionAnnotations . name ? `: ${ functionAnnotations . name } ` : ""
50- } `;
47+ const testDescription = `${ functionCall . name } ${
48+ functionAnnotations . name ? `: ${ functionAnnotations . name } ` : ""
49+ } `;
5150 it ( testDescription , ( ) => {
5251 // handle prepare function for this test
5352 if ( hasDefaultPrepareFunction && ! functionAnnotations . prepare )
@@ -56,11 +55,13 @@ export function generateUnitTests(simnet: Simnet) {
5655 delete functionAnnotations . prepare ;
5756
5857 // handle caller address for this test
59- const callerAddress = functionAnnotations . caller && typeof functionAnnotations . caller === "string"
60- ? functionAnnotations . caller [ 0 ] === "'"
61- ? `${ ( functionAnnotations . caller as string ) . substring ( 1 ) } `
62- : accounts . get ( functionAnnotations . caller ) !
63- : accounts . get ( "deployer" ) ! ;
58+ const callerAddress =
59+ functionAnnotations . caller &&
60+ typeof functionAnnotations . caller === "string"
61+ ? functionAnnotations . caller [ 0 ] === "'"
62+ ? `${ ( functionAnnotations . caller as string ) . substring ( 1 ) } `
63+ : accounts . get ( functionAnnotations . caller ) !
64+ : accounts . get ( "deployer" ) ! ;
6465
6566 if ( functionAnnotations . prepare ) {
6667 // mine block with prepare function call
0 commit comments