import { describe, expect, it } from 'vitest';
import { buildHtmlLink } from '@/utils/share/buildHtmlLink';
describe('buildHtmlLink', () => {
it('builds an anchor with escaped href and label', () => {
expect(buildHtmlLink('photo.jpg', 'https://example.com/v/1#key')).toBe(
'photo.jpg'
);
});
it('escapes HTML in link label', () => {
expect(buildHtmlLink('', 'https://example.com/v/1')).toBe(
'<script>alert(1)</script>'
);
});
it('escapes quotes in href', () => {
expect(buildHtmlLink('label', 'https://example.com/x" y')).toBe(
'label'
);
});
});