Skip to content

Commit d266be6

Browse files
committed
fix: delegated ada format
1 parent 8515b5c commit d266be6

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

tests/govtool-frontend/playwright/lib/helpers/adaFormat.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,12 @@ export const correctVoteAdaFormat = (
2020
}
2121
return "0";
2222
};
23+
24+
export const correctDelegatedVoteAdaFormat = (ada: number | undefined) => {
25+
if (ada) {
26+
return ada.toLocaleString("en-us", {
27+
maximumFractionDigits: 3,
28+
});
29+
}
30+
return "0";
31+
};

tests/govtool-frontend/playwright/tests/2-delegation/delegationFunctionality.delegation.spec.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
} from "@constants/staticWallets";
1212
import { createTempDRepAuth } from "@datafactory/createAuth";
1313
import { test } from "@fixtures/walletExtension";
14+
import { correctDelegatedVoteAdaFormat } from "@helpers/adaFormat";
1415
import { setAllureEpic } from "@helpers/allure";
1516
import { skipIfMainnet, skipIfNotHardFork } from "@helpers/cardano";
1617
import { createNewPageWithWallet } from "@helpers/page";
@@ -264,7 +265,11 @@ test.describe("Abstain delegation", () => {
264265

265266
const balance = await kuberService.getBalance(adaHolder03Wallet.address);
266267

267-
await expect(page.getByText(`You have delegated ₳${balance}`)).toBeVisible({
268+
await expect(
269+
page.getByText(
270+
`You have delegated ₳${correctDelegatedVoteAdaFormat(balance)}`
271+
)
272+
).toBeVisible({
268273
timeout: 60_000,
269274
});
270275
});
@@ -291,7 +296,11 @@ test.describe("No confidence delegation", () => {
291296
await waitForTxConfirmation(page);
292297

293298
const balance = await kuberService.getBalance(adaHolder04Wallet.address);
294-
await expect(page.getByText(`You have delegated ₳${balance}`)).toBeVisible({
299+
await expect(
300+
page.getByText(
301+
`You have delegated ₳${correctDelegatedVoteAdaFormat(balance)}`
302+
)
303+
).toBeVisible({
295304
timeout: 60_000,
296305
});
297306
});
@@ -317,13 +326,15 @@ test.describe("Delegated ADA visibility", () => {
317326
adaHolder06Wallet.address
318327
);
319328
await expect(
320-
page.getByText(`You have delegated ₳ ${adaHolderVotingPower}`)
329+
page.getByText(
330+
`You have delegated ₳ ${correctDelegatedVoteAdaFormat(adaHolderVotingPower)}`
331+
)
321332
).toBeVisible({ timeout: 60_000 });
322333

323334
await page.goto("/");
324335
await expect(
325336
page.getByText(
326-
`Your Voting Power of ₳${adaHolderVotingPower} is Delegated to`
337+
`Your Voting Power of ₳${correctDelegatedVoteAdaFormat(adaHolderVotingPower)} is Delegated to`
327338
)
328339
).toBeVisible({ timeout: 60_000 });
329340
});

0 commit comments

Comments
 (0)