Skip to content

Commit 9285078

Browse files
committed
test: reorganize the tests
1 parent f848c3d commit 9285078

File tree

9 files changed

+14
-12
lines changed

9 files changed

+14
-12
lines changed

src/releases/lockup/v2.0/deployments.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ export const mainnets: Sablier.Deployment[] = [
170170
[manifest.HELPERS]: "0x424B27529B49EF4Bfa0727aFcFE4387Ac2932944",
171171
[manifest.LOCKUP_NFT_DESCRIPTOR]: "0xeaFB40669fe3523b073904De76410b46e79a56D7",
172172
[manifest.SABLIER_BATCH_LOCKUP]: "0xAc2E42b520364940c90Ce164412Ca9BA212d014B",
173-
[manifest.SABLIER_LOCKUP]: ["0x28fCAE6bda2546C93183EeC8638691B2EB184003", 11_275_708],
173+
[manifest.SABLIER_LOCKUP]: ["0x0000000000000000000000000000000000001010", 11_275_708],
174174
[manifest.VESTING_MATH]: "0x9971914DA16787F6cCfb27bEfB4404e33C8b869D",
175175
}),
176176
get(chains.superseed.id, {
File renamed without changes.
File renamed without changes.
File renamed without changes.

tests/utils/finders.ts renamed to tests/deployments/utils/finders.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import _ from "lodash";
2-
import type { BasicContract, BroadcastJSON, ZKBroadcastJSON } from "./types";
2+
import type { BasicContract, BroadcastJSON, ZKBroadcastJSON } from "../../types";
33

44
const CONTRACT_PREFIX = "contract ";
55

tests/utils/generators.ts renamed to tests/deployments/utils/generators.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import queries from "@src/queries";
22
import type { Sablier } from "@src/types";
33
import _ from "lodash";
44
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";
67
import { findContract, findZKContract, loadBroadcastJSON, loadZKBroadcastJSONs } from "./helpers";
7-
import type { BasicContract, BroadcastJSON, ZKBroadcastJSON } from "./types";
88

99
type Validated = {
1010
[chainId: number]: {
@@ -15,7 +15,7 @@ type Validated = {
1515
};
1616
const validatedContracts: Validated = {};
1717

18-
export function validateContract(contract: BasicContract, expectedContract: BasicContract): void {
18+
function expectContract(contract: BasicContract, expectedContract: BasicContract): void {
1919
const address = contract.address.toLowerCase();
2020
const expectedAddress = expectedContract.address.toLowerCase();
2121
expect(address).toBe(expectedAddress);
@@ -24,7 +24,7 @@ export function validateContract(contract: BasicContract, expectedContract: Basi
2424
expect(name).toBe(expectedContract.name);
2525
}
2626

27-
export function validateZKContract(contract: BasicContract, zkBroadcast: ZKBroadcastJSON): void {
27+
function expectZKContract(contract: BasicContract, zkBroadcast: ZKBroadcastJSON): void {
2828
const address = contract.address.toLowerCase();
2929
const expectedAddress = zkBroadcast.entries[0].address.toLowerCase();
3030
expect(address).toBe(expectedAddress);
@@ -41,7 +41,7 @@ export function validateZKContract(contract: BasicContract, zkBroadcast: ZKBroad
4141
type TestConfig<BD, CD> = {
4242
finder: (data: BD, contractName: string) => CD | null;
4343
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;
4545
};
4646

4747
function createInnerTests<BD, CD>(
@@ -76,7 +76,9 @@ function createInnerTests<BD, CD>(
7676
expect(previouslyValidated, message).toBeTruthy();
7777
return;
7878
}
79-
testConfig.validator(contract, contractData);
79+
80+
// Run the test.
81+
testConfig.expector(contract, contractData);
8082

8183
// Mark this contract as validated for this chain.
8284
_.set(validatedContracts, [chain.id, contract.name, contract.address], true);
@@ -111,17 +113,17 @@ export function createStandardTests(
111113
chain: Sablier.Chain,
112114
): void {
113115
createContractTests<BroadcastJSON, BasicContract>(release, deployment, chain, {
116+
expector: expectContract,
114117
finder: findContract,
115118
loader: loadBroadcastJSON,
116-
validator: validateContract,
117119
});
118120
}
119121

120122
export function createZKTests(release: Sablier.Release, deployment: Sablier.Deployment, chain: Sablier.Chain): void {
121123
createContractTests<ZKBroadcastJSON[], ZKBroadcastJSON>(release, deployment, chain, {
124+
expector: expectZKContract,
122125
finder: findZKContract,
123126
loader: loadZKBroadcastJSONs,
124-
validator: validateZKContract,
125127
});
126128
}
127129

tests/utils/helpers.ts renamed to tests/deployments/utils/helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { logAndThrow } from "@scripts/logger";
44
import type { Sablier } from "@src/types";
55
import { globby } from "globby";
66
import _ from "lodash";
7-
import type { BasicContract, BroadcastJSON, ZKBroadcastJSON } from "./types";
7+
import type { BasicContract, BroadcastJSON, ZKBroadcastJSON } from "../../types";
88

99
const CONTRACT_PREFIX = "contract ";
1010

tests/utils/loaders.ts renamed to tests/deployments/utils/loaders.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import fs from "node:fs";
22
import { checkBroadcast } from "@scripts/check-broadcasts";
33
import type { Sablier } from "@src/types";
44
import { globby } from "globby";
5-
import type { BroadcastJSON, ZKBroadcastJSON } from "./types";
5+
import type { BroadcastJSON, ZKBroadcastJSON } from "../../types";
66

77
export async function loadBroadcastJSON(
88
release: Sablier.Release,
File renamed without changes.

0 commit comments

Comments
 (0)