Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mstrasinskis committed Jan 14, 2025
1 parent 4337bb7 commit 8c460b8
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -164,4 +164,46 @@ describe("NnsStakeItemAction", () => {

expect(await po.getNnsNeuronRewardStatusActionPo().isPresent()).toBe(false);
});

it("should render voting power w/o extra styling when not reduced voting power", async () => {
overrideFeatureFlagsStore.setFlag(
"ENABLE_PERIODIC_FOLLOWING_CONFIRMATION",
true
);
const neuron: NeuronInfo = {
...mockNeuron,
dissolveDelaySeconds: BigInt(NNS_MINIMUM_DISSOLVE_DELAY_TO_VOTE),
decidingVotingPower: 614000000n,
potentialVotingPower: 614000000n,
fullNeuron: {
...mockFullNeuron,
decidingVotingPower: 614000000n,
potentialVotingPower: 614000000n,
},
};
const po = renderComponent(neuron);

expect(await po.isReducedVotingPowerStyle()).toBe(false);
});

it("should render voting power in red when reduced voting power", async () => {
overrideFeatureFlagsStore.setFlag(
"ENABLE_PERIODIC_FOLLOWING_CONFIRMATION",
true
);
const neuron: NeuronInfo = {
...mockNeuron,
dissolveDelaySeconds: BigInt(NNS_MINIMUM_DISSOLVE_DELAY_TO_VOTE),
decidingVotingPower: 307000000n,
potentialVotingPower: 614000000n,
fullNeuron: {
...mockFullNeuron,
decidingVotingPower: 307000000n,
potentialVotingPower: 614000000n,
},
};
const po = renderComponent(neuron);

expect(await po.isReducedVotingPowerStyle()).toBe(true);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,10 @@ export class NnsNeuronVotingPowerSectionPo extends BasePageObject {
clickDisburse(): Promise<void> {
return this.getNeuronStateItemActionPo().clickDisburse();
}

async isReducedVotingPowerStyle(): Promise<boolean> {
return (await this.root.byTestId("voting-power").getClasses()).includes(
"isReducedVotingPower"
);
}
}

0 comments on commit 8c460b8

Please sign in to comment.