Skip to content

Commit

Permalink
chore: use new functions
Browse files Browse the repository at this point in the history
Signed-off-by: james-a-morris <jaamorris@cs.stonybrook.edu>
  • Loading branch information
james-a-morris committed Sep 4, 2024
1 parent 0ff3828 commit aa2d926
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions test/SpokePoolClient.ValidateFill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import {
bnOne,
InvalidFill,
fillStatusArray,
relayFillStatus,
validateFillForDeposit,
queryHistoricalDepositForFill,
DepositSearchResult,
} from "../src/utils";
import { CHAIN_ID_TEST_LIST, originChainId, destinationChainId, repaymentChainId } from "./constants";
import {
Expand Down Expand Up @@ -126,11 +126,11 @@ describe("SpokePoolClient: Fill Validation", function () {
outputAmount
);

let filled = await relayFillStatus(spokePool_2, deposit);
let filled = await spokePoolClient2.relayFillStatus(deposit);
expect(filled).to.equal(FillStatus.Unfilled);

await fillV3Relay(spokePool_2, deposit, relayer);
filled = await relayFillStatus(spokePool_2, deposit);
filled = await spokePoolClient2.relayFillStatus(deposit);
expect(filled).to.equal(FillStatus.Filled);
});

Expand Down Expand Up @@ -439,7 +439,9 @@ describe("SpokePoolClient: Fill Validation", function () {

const historicalDeposit = await queryHistoricalDepositForFill(spokePoolClient1, fill);
assert.equal(historicalDeposit.found, true, "Test is broken"); // Help tsc to narrow the discriminated union.
expect(historicalDeposit.deposit.depositId).to.deep.equal(deposit.depositId);
expect((historicalDeposit as Extract<DepositSearchResult, { found: true }>).deposit.depositId).to.deep.equal(
deposit.depositId
);
});

it("Can fetch younger deposit matching fill", async function () {
Expand Down Expand Up @@ -473,7 +475,9 @@ describe("SpokePoolClient: Fill Validation", function () {

const historicalDeposit = await queryHistoricalDepositForFill(spokePoolClient1, fill);
assert.equal(historicalDeposit.found, true, "Test is broken"); // Help tsc to narrow the discriminated union.
expect(historicalDeposit.deposit.depositId).to.deep.equal(deposit.depositId);
expect((historicalDeposit as Extract<DepositSearchResult, { found: true }>).deposit.depositId).to.deep.equal(
deposit.depositId
);
});

it("Loads fills from memory with deposit ID > spoke pool client's earliest deposit ID queried", async function () {
Expand Down Expand Up @@ -547,7 +551,7 @@ describe("SpokePoolClient: Fill Validation", function () {
const search = await queryHistoricalDepositForFill(spokePoolClient1, fill);

assert.equal(search.found, false, "Test is broken"); // Help tsc to narrow the discriminated union.
expect(search.code).to.equal(InvalidFill.DepositIdInvalid);
expect((search as Extract<DepositSearchResult, { found: false }>).code).to.equal(InvalidFill.DepositIdInvalid);
expect(lastSpyLogIncludes(spy, "Queried RPC for deposit")).is.not.true;
});

Expand All @@ -572,7 +576,7 @@ describe("SpokePoolClient: Fill Validation", function () {
const search = await queryHistoricalDepositForFill(spokePoolClient1, fill);

assert.equal(search.found, false, "Test is broken"); // Help tsc to narrow the discriminated union.
expect(search.code).to.equal(InvalidFill.DepositIdInvalid);
expect((search as Extract<DepositSearchResult, { found: false }>).code).to.equal(InvalidFill.DepositIdInvalid);
expect(lastSpyLogIncludes(spy, "Queried RPC for deposit")).is.not.true;
});

Expand All @@ -594,7 +598,7 @@ describe("SpokePoolClient: Fill Validation", function () {

const search = await queryHistoricalDepositForFill(spokePoolClient1, fill);
assert.equal(search.found, false, "Test is broken"); // Help tsc to narrow the discriminated union.
expect(search.code).to.equal(InvalidFill.FillMismatch);
expect((search as Extract<DepositSearchResult, { found: false }>).code).to.equal(InvalidFill.FillMismatch);
});

it("Returns sped up deposit matched with fill", async function () {
Expand Down

0 comments on commit aa2d926

Please sign in to comment.