Skip to content

Commit

Permalink
chore: add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
devdanco committed Sep 25, 2023
1 parent b98f348 commit 0462c9b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
7 changes: 3 additions & 4 deletions test/burn-liquidity.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ beforeEach(async () => {
});

it("should burn liquidity", async () => {
const beforePools = await instance.query.getPools();

const argsPool: CreatePool = {
account: testUser,
Expand Down Expand Up @@ -100,7 +99,7 @@ it("should burn liquidity", async () => {

await instance.rpc.waitForNewBlock(2);

const afterPools = await instance.query.getPools();

expect(beforePools.length).not.to.equal(afterPools);
const currentPool = await instance.query.getPool(liquidityTokenId)
expect(currentPool.firstTokenAmount.toString()).toEqual("0")
expect(currentPool.secondTokenAmount.toString()).toEqual("0")
});
2 changes: 1 addition & 1 deletion test/instance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ setLoggerOptions({
hideLogPositionForProduction: false
});

const uri = process.env.API_URL || "ws://127.0.0.1:9947";
const uri = process.env.API_URL || "ws://127.0.0.1:9946";

export const instance = Mangata.instance([uri]);
export const SUDO_USER_NAME = process.env.TEST_SUDO_NAME || "//Alice";
9 changes: 9 additions & 0 deletions test/tradeable-tokens.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { it, expect } from "vitest";
import { instance } from "./instance";

it("should calculate buy price for 1 KSM", async () => {
const tokens = await instance.rpc.getTradeableTokens()
const mangataToken = tokens.find(token => token.tokenId === "0")
expect(mangataToken?.name).toEqual("Mangata");
expect(mangataToken?.decimals).toEqual(18);
});

0 comments on commit 0462c9b

Please sign in to comment.