Files
splitt-the-bill/shared/utils/paymentLink.test.ts
T
anbraten cbe1b42f6e
tinyedge/deploy Deployed by TinyEdge
🐛 add env to useDb and apply prettier
2026-08-07 13:28:26 +02:00

25 lines
717 B
TypeScript

import { describe, expect, it } from 'vitest';
import { isValidPaymentLink } from './paymentLink';
describe('isValidPaymentLink', () => {
it('accepts an https PayPal.me link', () => {
expect(isValidPaymentLink('https://paypal.me/janedoe')).toBe(true);
});
it('accepts an http link', () => {
expect(isValidPaymentLink('http://paypal.me/janedoe')).toBe(true);
});
it('rejects an empty string', () => {
expect(isValidPaymentLink('')).toBe(false);
});
it('rejects a javascript: URI', () => {
expect(isValidPaymentLink('javascript:alert(1)')).toBe(false);
});
it('rejects a value that is not a URL at all', () => {
expect(isValidPaymentLink('not a link')).toBe(false);
});
});