@@ -2,9 +2,9 @@ import queries from "@src/queries";
2
2
import type { Sablier } from "@src/types" ;
3
3
import _ from "lodash" ;
4
4
import { beforeAll , describe , expect , it } from "vitest" ;
5
- import { isKnownMissing } from "../setup/missing" ;
5
+ import { isKnownMissing } from "../../setup/missing" ;
6
+ import type { BasicContract , BroadcastJSON , ZKBroadcastJSON } from "../../types" ;
6
7
import { findContract , findZKContract , loadBroadcastJSON , loadZKBroadcastJSONs } from "./helpers" ;
7
- import type { BasicContract , BroadcastJSON , ZKBroadcastJSON } from "./types" ;
8
8
9
9
type Validated = {
10
10
[ chainId : number ] : {
@@ -15,7 +15,7 @@ type Validated = {
15
15
} ;
16
16
const validatedContracts : Validated = { } ;
17
17
18
- export function validateContract ( contract : BasicContract , expectedContract : BasicContract ) : void {
18
+ function expectContract ( contract : BasicContract , expectedContract : BasicContract ) : void {
19
19
const address = contract . address . toLowerCase ( ) ;
20
20
const expectedAddress = expectedContract . address . toLowerCase ( ) ;
21
21
expect ( address ) . toBe ( expectedAddress ) ;
@@ -24,7 +24,7 @@ export function validateContract(contract: BasicContract, expectedContract: Basi
24
24
expect ( name ) . toBe ( expectedContract . name ) ;
25
25
}
26
26
27
- export function validateZKContract ( contract : BasicContract , zkBroadcast : ZKBroadcastJSON ) : void {
27
+ function expectZKContract ( contract : BasicContract , zkBroadcast : ZKBroadcastJSON ) : void {
28
28
const address = contract . address . toLowerCase ( ) ;
29
29
const expectedAddress = zkBroadcast . entries [ 0 ] . address . toLowerCase ( ) ;
30
30
expect ( address ) . toBe ( expectedAddress ) ;
@@ -41,7 +41,7 @@ export function validateZKContract(contract: BasicContract, zkBroadcast: ZKBroad
41
41
type TestConfig < BD , CD > = {
42
42
finder : ( data : BD , contractName : string ) => CD | null ;
43
43
loader : ( release : Sablier . Release , chain : Sablier . Chain , componentName ?: string ) => Promise < BD | null > ;
44
- validator : ( contract : BasicContract , data : CD ) => void ;
44
+ expector : ( contract : BasicContract , data : CD ) => void ;
45
45
} ;
46
46
47
47
function createInnerTests < BD , CD > (
@@ -76,7 +76,9 @@ function createInnerTests<BD, CD>(
76
76
expect ( previouslyValidated , message ) . toBeTruthy ( ) ;
77
77
return ;
78
78
}
79
- testConfig . validator ( contract , contractData ) ;
79
+
80
+ // Run the test.
81
+ testConfig . expector ( contract , contractData ) ;
80
82
81
83
// Mark this contract as validated for this chain.
82
84
_ . set ( validatedContracts , [ chain . id , contract . name , contract . address ] , true ) ;
@@ -111,17 +113,17 @@ export function createStandardTests(
111
113
chain : Sablier . Chain ,
112
114
) : void {
113
115
createContractTests < BroadcastJSON , BasicContract > ( release , deployment , chain , {
116
+ expector : expectContract ,
114
117
finder : findContract ,
115
118
loader : loadBroadcastJSON ,
116
- validator : validateContract ,
117
119
} ) ;
118
120
}
119
121
120
122
export function createZKTests ( release : Sablier . Release , deployment : Sablier . Deployment , chain : Sablier . Chain ) : void {
121
123
createContractTests < ZKBroadcastJSON [ ] , ZKBroadcastJSON > ( release , deployment , chain , {
124
+ expector : expectZKContract ,
122
125
finder : findZKContract ,
123
126
loader : loadZKBroadcastJSONs ,
124
- validator : validateZKContract ,
125
127
} ) ;
126
128
}
127
129
0 commit comments