Skip to content

Commit 1db36c6

Browse files
committed
test: rename to "missing-broadcasts"
test: rename to "componentName"
1 parent 4cf9067 commit 1db36c6

File tree

4 files changed

+18
-19
lines changed

4 files changed

+18
-19
lines changed

tests/utils/generators.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { getChain } from "@src/helpers";
2+
import { isLockupV1Release } from "@src/helpers";
23
import type { Sablier } from "@src/types";
3-
import { isLockupV1Release } from "@src/types";
44
import _ from "lodash";
55
import { beforeAll, describe, expect, it } from "vitest";
66
import { findContract, findZKContract, loadBroadcastJSON, loadZKBroadcastJSONs } from "./helpers";
7-
import { isKnownMissing } from "./known-missing";
7+
import { isKnownMissing } from "./missing-broadcasts";
88
import type { BroadcastJSON, ZKBroadcastJSON } from "./types";
99

1010
/**
@@ -41,7 +41,7 @@ export function validateZKContract(contract: Sablier.Contract, zkBroadcast: ZKBr
4141
*/
4242
interface TestConfig<BD, CD> {
4343
finder: (data: BD, contractName: string) => CD | null;
44-
loader: (release: Sablier.Release, chain: Sablier.Chain, releaseModule?: string) => Promise<BD | null>;
44+
loader: (release: Sablier.Release, chain: Sablier.Chain, componentName?: string) => Promise<BD | null>;
4545
validator: (contract: Sablier.Contract, data: CD) => void;
4646
}
4747

@@ -51,13 +51,13 @@ function createInnerTests<BD, CD>(
5151
release: Sablier.Release,
5252
chain: Sablier.Chain,
5353
contracts: Sablier.Contract[],
54-
releaseModule?: string,
54+
componentName?: string,
5555
): void {
5656
describe(testDescription, () => {
5757
let broadcastData: BD | null;
5858

5959
beforeAll(async () => {
60-
broadcastData = await testConfig.loader(release, chain, releaseModule);
60+
broadcastData = await testConfig.loader(release, chain, componentName);
6161
});
6262

6363
for (const contract of contracts) {
@@ -73,7 +73,6 @@ function createInnerTests<BD, CD>(
7373
// As a fallback, we check if this contract has already been validated. Some contracts
7474
// are shared between releases (e.g., Comptroller in Lockup v1.0 and v1.1).
7575
const previouslyValidated = _.get(validated, [contract.address, contract.name, chain.id]);
76-
// TODO: throw more explanatory error message
7776
expect(previouslyValidated).toBeTruthy();
7877
return;
7978
}

tests/utils/helpers.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ export function findInLibraries(data: BroadcastJSON, contractName: string): Sabl
7676
export async function loadBroadcastJSON(
7777
release: Sablier.Release,
7878
chain: Sablier.Chain,
79-
releaseModule?: string,
79+
componentName?: string,
8080
): Promise<BroadcastJSON | null> {
81-
const foundPath = await checkBroadcast(release, chain, releaseModule);
81+
const foundPath = await checkBroadcast(release, chain, componentName);
8282
if (!foundPath) {
8383
return null;
8484
}
@@ -93,9 +93,9 @@ export async function loadBroadcastJSON(
9393
export async function loadZKBroadcastJSONs(
9494
release: Sablier.Release,
9595
chain: Sablier.Chain,
96-
releaseModule?: string,
96+
componentName?: string,
9797
): Promise<ZKBroadcastJSON[] | null> {
98-
const dirs = await checkZKBroadcast(release, chain, releaseModule);
98+
const dirs = await checkZKBroadcast(release, chain, componentName);
9999
if (!dirs) {
100100
return null;
101101
}

tests/utils/loaders.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ import type { BroadcastJSON, ZKBroadcastJSON } from "./types";
77
export async function loadBroadcastJSON(
88
release: Sablier.Release,
99
chain: Sablier.Chain,
10-
releaseModule?: string,
10+
componentName?: string,
1111
): Promise<BroadcastJSON | null> {
12-
const foundPath = await checkBroadcast(release, chain, releaseModule);
12+
const foundPath = await checkBroadcast(release, chain, componentName);
1313
if (!foundPath) {
1414
return null;
1515
}
@@ -24,9 +24,9 @@ export async function loadBroadcastJSON(
2424
export async function loadZKBroadcastJSONs(
2525
release: Sablier.Release,
2626
chain: Sablier.Chain,
27-
releaseModule?: string,
27+
componentName?: string,
2828
): Promise<ZKBroadcastJSON[] | null> {
29-
const dirs = await checkZKBroadcast(release, chain, releaseModule);
29+
const dirs = await checkZKBroadcast(release, chain, componentName);
3030
if (!dirs) {
3131
return null;
3232
}

tests/utils/known-missing.ts renamed to tests/utils/missing-broadcasts.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@ import { ChainId } from "@src/chains/ids";
22
import { names as lockupNamesV1_0 } from "@src/releases/lockup/v1.0/manifest";
33
import { names as lockupNamesV1_1 } from "@src/releases/lockup/v1.1/manifest";
44
import type { Sablier } from "@src/types";
5-
import { versions } from "@src/versions";
65
import _ from "lodash";
76

87
type ContractMap = Record<string, boolean>;
98
type ChainMap = Record<number, ContractMap>;
109
type VersionMap = Partial<Record<Sablier.Version, ChainMap>>;
1110
type ProtocolMap = Partial<Record<Sablier.Protocol, VersionMap>>;
1211

13-
export const knownMissing: ProtocolMap = {
12+
// A map of known missing broadcasts.
13+
export const missingBroadcasts: ProtocolMap = {
1414
lockup: {
15-
[versions.lockup.v1_0]: {
15+
"v1.0": {
1616
[ChainId.ARBITRUM_SEPOLIA]: {
1717
[lockupNamesV1_0.core.SABLIER_V2_COMPTROLLER]: true,
1818
},
1919
},
20-
[versions.lockup.v1_1]: {
20+
"v1.1": {
2121
[ChainId.ARBITRUM_ONE]: {
2222
[lockupNamesV1_1.core.SABLIER_V2_LOCKUP_LINEAR]: true,
2323
[lockupNamesV1_1.core.SABLIER_V2_NFT_DESCRIPTOR]: true,
@@ -57,5 +57,5 @@ export const knownMissing: ProtocolMap = {
5757
};
5858

5959
export function isKnownMissing(release: Sablier.Release, chain: Sablier.Chain, contractName: string): boolean {
60-
return _.get(knownMissing, [release.protocol, release.version, chain.id, contractName]) ?? false;
60+
return _.get(missingBroadcasts, [release.protocol, release.version, chain.id, contractName]) ?? false;
6161
}

0 commit comments

Comments
 (0)