Skip to content

Commit

Permalink
chore: add test
Browse files Browse the repository at this point in the history
  • Loading branch information
cjkoepke committed Sep 10, 2024
1 parent 96b5493 commit 3574dba
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions packages/core/src/Utilities/__tests__/SundaeUtils.class.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -441,4 +441,55 @@ describe("SundaeUtils class", () => {
expect(result).toBe(false);
});
});

describe("getIdentFromAssetId", () => {
it("should get the ident from a v3 pool", () => {
expect(
SundaeUtils.getIdentFromAssetId(
PREVIEW_DATA.pools.v3.assetLP.assetId,
EContractVersion.V3
)
);
});

it("should get the ident from a v1 pool", () => {
expect(
SundaeUtils.getIdentFromAssetId(
PREVIEW_DATA.pools.v1.assetLP.assetId,
EContractVersion.V1
)
);
});

it("should throw an error if the LP token doesn't match the contract version", () => {
expect(() =>
SundaeUtils.getIdentFromAssetId(
PREVIEW_DATA.pools.v1.assetLP.assetId,
EContractVersion.V3
)
).toThrowError(
new Error("Could not find an LP token prefix in this asset ID!")
);

expect(() =>
SundaeUtils.getIdentFromAssetId(
PREVIEW_DATA.pools.v3.assetLP.assetId,
EContractVersion.V1
)
).toThrowError(
new Error("Could not find an LP token prefix in this asset ID!")
);
});

it("should throw an error if not an LP token", () => {
expect(() =>
SundaeUtils.getIdentFromAssetId(
PREVIEW_DATA.pools.v1.assetA.assetId,
EContractVersion.V1
)
).toThrowError(
new Error("Could not find an LP token prefix in this asset ID!")
);
});
});
});

0 comments on commit 3574dba

Please sign in to comment.