Skip to content

Commit e693249

Browse files
committed
Move invariant test-related interfaces to invariant.types.ts
1 parent 3a66a2a commit e693249

2 files changed

Lines changed: 37 additions & 27 deletions

File tree

invariant.ts

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ import fc from "fast-check";
1515
import { DialerRegistry, PostDialerError, PreDialerError } from "./dialer";
1616
import { reporter } from "./heatstroke";
1717
import type { Statistics } from "./heatstroke.types";
18-
import type { LocalContext } from "./invariant.types";
18+
import type {
19+
InvariantTestConfig,
20+
InvariantTestContext,
21+
LocalContext,
22+
} from "./invariant.types";
1923
import { strategyFor } from "./lib";
2024
import {
2125
getFailureFilePath,
@@ -276,32 +280,6 @@ export const checkInvariants = async (
276280
}
277281
};
278282

279-
/**
280-
* The configuration for an invariant test.
281-
*/
282-
interface InvariantTestConfig {
283-
simnet: Simnet;
284-
targetContractName: string;
285-
rendezvousContractId: string;
286-
runs: number | undefined;
287-
seed: number | undefined;
288-
bail: boolean;
289-
dial: string | undefined;
290-
radio: EventEmitter;
291-
eligibleAccounts: Map<string, string>;
292-
allAddresses: string[];
293-
}
294-
295-
/**
296-
* The context to run an invariant test with.
297-
*/
298-
interface InvariantTestContext {
299-
/** SUT functions for the target contract. */
300-
functions: EnrichedContractInterfaceFunction[];
301-
/** Invariant functions for the target contract. */
302-
invariants: EnrichedContractInterfaceFunction[];
303-
}
304-
305283
/**
306284
* Runs an invariant test.
307285
* @param config The union of the configuration and context for the invariant

invariant.types.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
import type { EventEmitter } from "node:events";
2+
3+
import type { Simnet } from "@stacks/clarinet-sdk";
4+
5+
import type { EnrichedContractInterfaceFunction } from "./shared.types";
6+
17
type ContractId = string;
28

39
type SutFunctionName = string;
@@ -10,3 +16,29 @@ type SutFunctionName = string;
1016
* - The value is the count of times the SUT function has been invoked.
1117
*/
1218
export type LocalContext = Record<ContractId, Record<SutFunctionName, number>>;
19+
20+
/**
21+
* The configuration for an invariant test.
22+
*/
23+
export interface InvariantTestConfig {
24+
simnet: Simnet;
25+
targetContractName: string;
26+
rendezvousContractId: string;
27+
runs: number | undefined;
28+
seed: number | undefined;
29+
bail: boolean;
30+
dial: string | undefined;
31+
radio: EventEmitter;
32+
eligibleAccounts: Map<string, string>;
33+
allAddresses: string[];
34+
}
35+
36+
/**
37+
* The context to run an invariant test with.
38+
*/
39+
export interface InvariantTestContext {
40+
/** SUT functions for the target contract. */
41+
functions: EnrichedContractInterfaceFunction[];
42+
/** Invariant functions for the target contract. */
43+
invariants: EnrichedContractInterfaceFunction[];
44+
}

0 commit comments

Comments
 (0)