78f5a9c520
Co-authored-by: candida-d <62548908+candida-d@users.noreply.github.com> Co-authored-by: Matthew Russell <mattrussell36@gmail.com> Co-authored-by: bwallacee <ben@vega.xyz>
59 lines
1.7 KiB
TypeScript
59 lines
1.7 KiB
TypeScript
import { render, screen } from '@testing-library/react';
|
|
import { RewardHoarderBonus } from './reward-hoarder-bonus';
|
|
import type { PartyVestingStats } from '@vegaprotocol/types';
|
|
|
|
describe('RewardHoarderBonus', () => {
|
|
it('renders null when vestingDetails is not provided', () => {
|
|
const tiers: {
|
|
minimum_quantum_balance: string;
|
|
reward_multiplier: string;
|
|
}[] = [];
|
|
const vestingDetails = null;
|
|
render(
|
|
<RewardHoarderBonus tiers={tiers} vestingDetails={vestingDetails} />
|
|
);
|
|
const component = screen.queryByText(/Reward bonus/i);
|
|
expect(component).toBeNull();
|
|
});
|
|
|
|
it('renders null when tiers are empty', () => {
|
|
const tiers: {
|
|
minimum_quantum_balance: string;
|
|
reward_multiplier: string;
|
|
}[] = [];
|
|
const vestingDetails: PartyVestingStats = {
|
|
epochSeq: 0,
|
|
rewardBonusMultiplier: '1.5',
|
|
quantumBalance: '100',
|
|
};
|
|
render(
|
|
<RewardHoarderBonus tiers={tiers} vestingDetails={vestingDetails} />
|
|
);
|
|
const component = screen.queryByText(/Reward bonus/i);
|
|
expect(component).toBeNull();
|
|
});
|
|
|
|
it('renders the component with tiers and vestingDetails', () => {
|
|
const tiers = [
|
|
{
|
|
minimum_quantum_balance: '50',
|
|
reward_multiplier: '1.5x',
|
|
},
|
|
{
|
|
minimum_quantum_balance: '100',
|
|
reward_multiplier: '2x',
|
|
},
|
|
];
|
|
const vestingDetails = {
|
|
epochSeq: 0,
|
|
rewardBonusMultiplier: '1.5',
|
|
quantumBalance: '75',
|
|
};
|
|
render(
|
|
<RewardHoarderBonus tiers={tiers} vestingDetails={vestingDetails} />
|
|
);
|
|
const tierLabels = screen.getAllByText(/Tier/i);
|
|
expect(tierLabels.length).toBe(3); // 2 tiers + 1 label
|
|
});
|
|
});
|