Initial commit

This commit is contained in:
2026-02-06 15:28:27 -03:00
commit 4bc96abf4a
116 changed files with 13806 additions and 0 deletions

27
src/lib/utm.test.ts Normal file
View File

@@ -0,0 +1,27 @@
import { describe, it, expect } from 'vitest';
import { appendUtmParams } from './utm';
describe('utm', () => {
describe('appendUtmParams', () => {
it('appends utm params to own-property URL', () => {
const href = 'https://mifi.dev/page';
const result = appendUtmParams(href, 'mifi.dev');
const url = new URL(result);
expect(url.searchParams.get('utm_source')).toBe('mifi.dev');
expect(url.searchParams.get('utm_medium')).toBe('link');
expect(url.searchParams.get('utm_campaign')).toBe('landing');
});
it('appends utm_content when provided', () => {
const href = 'https://mifi.bio/';
const result = appendUtmParams(href, 'mifi.bio', 'hero');
const url = new URL(result);
expect(url.searchParams.get('utm_content')).toBe('hero');
});
it('returns href unchanged for non-own-property host', () => {
const href = 'https://example.com/page';
expect(appendUtmParams(href, 'mifi.dev')).toBe(href);
});
});
});