Skip to content

Commit dc66974

Browse files
committed
fix(exports): sanitize and canonicalize SVG before download
1 parent f4691af commit dc66974

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

components/dashboard/ShareSheet.test.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -354,12 +354,13 @@ describe('ShareSheet', () => {
354354
expect(screen.getByText('SVG Downloaded!')).toBeDefined();
355355
});
356356

357-
expect(global.fetch).toHaveBeenCalledWith(
358-
`/api/streak?user=${encodeURIComponent(defaultProps.username)}`
357+
const fetchedUrl = vi.mocked(global.fetch).mock.calls[0][0] as string;
358+
expect(fetchedUrl).toMatch(
359+
new RegExp(`/api/streak\\?user=${encodeURIComponent(defaultProps.username)}$`)
359360
);
360361

361362
const blob = vi.mocked(URL.createObjectURL).mock.calls[0][0] as Blob;
362-
expect(blob.type).toBe('image/svg+xml');
363+
expect(blob.type).toContain('image/svg+xml');
363364

364365
expect(HTMLAnchorElement.prototype.click).toHaveBeenCalled();
365366
expect(URL.revokeObjectURL).toHaveBeenCalledWith('blob:mock-download');

0 commit comments

Comments
 (0)