Skip to content

Commit

Permalink
undo handling undefined
Browse files Browse the repository at this point in the history
These env vars get set in test/environment.d.ts
  • Loading branch information
lalexgap committed Sep 6, 2023
1 parent 02c3182 commit 3a7a490
Show file tree
Hide file tree
Showing 14 changed files with 23 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,25 @@ const provider = getTestProvider();
const batchOperator = setupContract(
provider,
BatchOperatorArtifact,
process.env.BATCH_OPERATOR_ADDRESS || ''
process.env.BATCH_OPERATOR_ADDRESS
) as unknown as BatchOperator & Contract;

const nitroAdjudicator = setupContract(
provider,
NitroAdjudicatorArtifact,
process.env.NITRO_ADJUDICATOR_ADDRESS || ''
process.env.NITRO_ADJUDICATOR_ADDRESS
) as unknown as NitroAdjudicator & Contract;

const token = setupContract(
provider,
TokenArtifact,
process.env.TEST_TOKEN_ADDRESS || ''
process.env.TEST_TOKEN_ADDRESS
) as unknown as Token & Contract;

const badToken = setupContract(
provider,
BadTokenArtifact,
process.env.BAD_TOKEN_ADDRESS || ''
process.env.BAD_TOKEN_ADDRESS
) as unknown as BadToken & Contract;

const ETH = MAGIC_ADDRESS_INDICATING_ETH;
Expand Down Expand Up @@ -119,7 +119,7 @@ describe('deposit_batch', () => {
getChannelId({
channelNonce: getRandomNonce(description),
participants: [signerAddress, counterparty],
appDefinition: consensusApp || '',
appDefinition: consensusApp,
challengeDuration: 100,
})
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ async function createTwoPartySignedCountingAppState(
}

beforeAll(async () => {
ForceMove = setupContract(provider, ForceMoveArtifact, process.env.TEST_FORCE_MOVE_ADDRESS || '');
ForceMove = setupContract(provider, ForceMoveArtifact, process.env.TEST_FORCE_MOVE_ADDRESS);
});

// Scenarios are synonymous with channelNonce:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const defaultOutcome: Outcome = [
let appDefinition: string;

beforeAll(async () => {
ForceMove = setupContract(provider, ForceMoveArtifact, process.env.TEST_FORCE_MOVE_ADDRESS || '');
ForceMove = setupContract(provider, ForceMoveArtifact, process.env.TEST_FORCE_MOVE_ADDRESS);
appDefinition = getCountingAppContractAddress();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const outcome: Outcome = [{asset, allocations: [], assetMetadata: {assetType: 0,
let appDefinition: string;

beforeAll(async () => {
ForceMove = setupContract(provider, ForceMoveArtifact, process.env.TEST_FORCE_MOVE_ADDRESS || '');
ForceMove = setupContract(provider, ForceMoveArtifact, process.env.TEST_FORCE_MOVE_ADDRESS);
appDefinition = getCountingAppContractAddress();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {getTestProvider, randomChannelId, setupContract} from '../../test-helper
const provider = getTestProvider();
let ForceMove: Contract;
beforeAll(async () => {
ForceMove = setupContract(provider, ForceMoveArtifact, process.env.TEST_FORCE_MOVE_ADDRESS || '');
ForceMove = setupContract(provider, ForceMoveArtifact, process.env.TEST_FORCE_MOVE_ADDRESS);
});

const zeroData = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@ const provider = getTestProvider();
const testNitroAdjudicator = setupContract(
provider,
TESTNitroAdjudicatorArtifact,
process.env.TEST_NITRO_ADJUDICATOR_ADDRESS || ''
process.env.TEST_NITRO_ADJUDICATOR_ADDRESS
) as unknown as TESTNitroAdjudicator & Contract;

const token = setupContract(
provider,
TokenArtifact,
process.env.TEST_TOKEN_ADDRESS || ''
process.env.TEST_TOKEN_ADDRESS
) as unknown as Token & Contract;

const badToken = setupContract(
provider,
BadTokenArtifact,
process.env.BAD_TOKEN_ADDRESS || ''
process.env.BAD_TOKEN_ADDRESS
) as unknown as BadToken & Contract;

const signer0 = getTestProvider().getSigner(0); // Convention matches setupContract function
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const testProvider = getTestProvider();
const testNitroAdjudicator = setupContract(
testProvider,
TESTNitroAdjudicatorArtifact,
process.env.TEST_NITRO_ADJUDICATOR_ADDRESS || ''
process.env.TEST_NITRO_ADJUDICATOR_ADDRESS
) as unknown as TESTNitroAdjudicator & Contract;

const addresses = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ import {
const testNitroAdjudicator = setupContract(
getTestProvider(),
TESTNitroAdjudicatorArtifact,
process.env.TEST_NITRO_ADJUDICATOR_ADDRESS || ''
process.env.TEST_NITRO_ADJUDICATOR_ADDRESS
) as unknown as TESTNitroAdjudicator & Contract;

const token = setupContract(
getTestProvider(),
TokenArtifact,
process.env.TEST_TOKEN_ADDRESS || ''
process.env.TEST_TOKEN_ADDRESS
) as unknown as Token & Contract;

const provider = getTestProvider();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ import {replaceAddressesAndBigNumberify} from '../../../src/helpers';
const testNitroAdjudicator = setupContract(
getTestProvider(),
TESTNitroAdjudicatorArtifact,
process.env.TEST_NITRO_ADJUDICATOR_ADDRESS || ''
process.env.TEST_NITRO_ADJUDICATOR_ADDRESS
) as unknown as TESTNitroAdjudicator & Contract;

const token = setupContract(
getTestProvider(),
TokenArtifact,
process.env.TEST_TOKEN_ADDRESS || ''
process.env.TEST_TOKEN_ADDRESS
) as unknown as Token & Contract;

const addresses = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,7 @@ const challengeDuration = 0x100;
const whoSignedWhat = [1, 0];

beforeAll(async () => {
hashTimeLock = setupContract(
provider,
HashLockedSwapArtifact,
process.env.HASH_LOCK_ADDRESS || ''
);
hashTimeLock = setupContract(provider, HashLockedSwapArtifact, process.env.HASH_LOCK_ADDRESS);
});

const preImage = '0xdeadbeef';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ beforeAll(async () => {
singleAssetPayments = setupContract(
provider,
SingleAssetPaymentsArtifact,
process.env.SINGLE_ASSET_PAYMENTS_ADDRESS || ''
process.env.SINGLE_ASSET_PAYMENTS_ADDRESS
);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ beforeAll(async () => {
Consensus = setupContract(
provider,
testConsensusArtifact,
process.env.TEST_CONSENSUS_ADDRESS || ''
process.env.TEST_CONSENSUS_ADDRESS
) as Contract & TESTConsensus;
});

Expand Down Expand Up @@ -65,7 +65,7 @@ describe('requireConsensus', () => {
channelNonce,
challengeDuration,
outcome: defaultOutcome,
appDefinition: appDefinition || '',
appDefinition: appDefinition,
appData: '0x',
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ beforeAll(async () => {
StrictTurnTaking = setupContract(
provider,
testStrictTurnTakingArtifact,
process.env.TEST_STRICT_TURN_TAKING_ADDRESS || ''
process.env.TEST_STRICT_TURN_TAKING_ADDRESS
) as Contract & TESTStrictTurnTaking;
});

Expand Down
2 changes: 1 addition & 1 deletion packages/nitro-protocol/test/test-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export function setupContract(
}

export function getCountingAppContractAddress(): string {
return process.env.COUNTING_APP_ADDRESS || '';
return process.env.COUNTING_APP_ADDRESS;
}

export const nonParticipant = ethers.Wallet.createRandom();
Expand Down

0 comments on commit 3a7a490

Please sign in to comment.