feat: referal support
This commit is contained in:
@@ -113,7 +113,18 @@ describe('AccountPage', () => {
|
||||
vi.mocked(api.getDevices).mockResolvedValue(DEVICES);
|
||||
renderAccount();
|
||||
expect(await screen.findByText(SUB.subscription_link)).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: /копировать/i })).toBeEnabled();
|
||||
expect(screen.getByRole('button', { name: /копировать ссылку подписки/i })).toBeEnabled();
|
||||
});
|
||||
|
||||
it('renders a referral link with copy and QR actions', async () => {
|
||||
vi.mocked(api.getMe).mockResolvedValue(ME);
|
||||
vi.mocked(api.getSubscription).mockResolvedValue(SUB);
|
||||
vi.mocked(api.getDevices).mockResolvedValue(DEVICES);
|
||||
renderAccount();
|
||||
|
||||
const link = `${window.location.origin}/?ref=c`;
|
||||
expect(await screen.findByText(link)).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: /показать qr-код реферальной ссылки/i })).toBeEnabled();
|
||||
});
|
||||
|
||||
it('opens and closes the subscription QR code dialog', async () => {
|
||||
@@ -124,7 +135,7 @@ describe('AccountPage', () => {
|
||||
renderAccount();
|
||||
|
||||
await screen.findByText(SUB.subscription_link);
|
||||
await user.click(screen.getByRole('button', { name: /показать qr-код/i }));
|
||||
await user.click(screen.getByRole('button', { name: /показать qr-код ссылки подписки/i }));
|
||||
expect(await screen.findByRole('dialog', { name: /откройте на устройстве/i })).toBeInTheDocument();
|
||||
expect(await screen.findByAltText(/qr-код ссылки подписки/i)).toBeInTheDocument();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user