fix: types

This commit is contained in:
Ilia Mashkov
2026-01-09 16:48:26 +03:00
parent 7630802363
commit 77de829b04

View File

@@ -4,6 +4,7 @@ import {
it,
} from 'vitest';
import type {
FontItem,
FontshareFont,
GoogleFontItem,
} from '../../model/types';
@@ -82,42 +83,42 @@ describe('Font Normalization', () => {
});
it('handles sans-serif category', () => {
const font = { ...mockGoogleFont, category: 'sans-serif' };
const font: FontItem = { ...mockGoogleFont, category: 'sans-serif' };
const result = normalizeGoogleFont(font);
expect(result.category).toBe('sans-serif');
});
it('handles serif category', () => {
const font = { ...mockGoogleFont, category: 'serif' };
const font: FontItem = { ...mockGoogleFont, category: 'serif' };
const result = normalizeGoogleFont(font);
expect(result.category).toBe('serif');
});
it('handles display category', () => {
const font = { ...mockGoogleFont, category: 'display' };
const font: FontItem = { ...mockGoogleFont, category: 'display' };
const result = normalizeGoogleFont(font);
expect(result.category).toBe('display');
});
it('handles handwriting category', () => {
const font = { ...mockGoogleFont, category: 'handwriting' };
const font: FontItem = { ...mockGoogleFont, category: 'handwriting' };
const result = normalizeGoogleFont(font);
expect(result.category).toBe('handwriting');
});
it('handles cursive category (maps to handwriting)', () => {
const font = { ...mockGoogleFont, category: 'cursive' };
const font: FontItem = { ...mockGoogleFont, category: 'cursive' };
const result = normalizeGoogleFont(font);
expect(result.category).toBe('handwriting');
});
it('handles monospace category', () => {
const font = { ...mockGoogleFont, category: 'monospace' };
const font: FontItem = { ...mockGoogleFont, category: 'monospace' };
const result = normalizeGoogleFont(font);
expect(result.category).toBe('monospace');
@@ -522,22 +523,6 @@ describe('Font Normalization', () => {
expect(result.category).toBe('sans-serif'); // fallback
});
it('handles unknown Google Font category', () => {
const font: GoogleFontItem = {
family: 'Test',
category: 'unknown',
variants: ['regular'],
subsets: ['latin'],
files: { regular: 'url' },
version: 'v1',
lastModified: '2022-01-01',
menu: 'https://fonts.googleapis.com/css2?family=Test',
};
const result = normalizeGoogleFont(font);
expect(result.category).toBe('sans-serif'); // fallback
});
});
});