mirror of
https://github.com/lucide-icons/lucide.git
synced 2026-11-12 13:38:32 +00:00
* Add typecheck jobs
* update lockfile
* Fix types
* Fix lucide solid types
* Fix type lucide-react-native
* fix: align react-native svg mock children typing
* fix: format build font spec
* fix: restore shared workflow and RN class context
* fix: restore lucide-react build typecheck
* fix: keep react build generating icons
* fix: preserve builder color prop types
* test: cover RN provider class merge
* Revert 711255b
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
33 lines
1015 B
TypeScript
33 lines
1015 B
TypeScript
import { describe, it, expect } from 'vitest';
|
|
import { toLucideIconData } from '../src/utils/toLucideIconData';
|
|
import type { LucideIconNode } from '../src/build/types';
|
|
|
|
describe('toLucideIconData', () => {
|
|
it('converts legacy name and node to icon data object', () => {
|
|
const iconNode: LucideIconNode[] = [['path', { d: 'M0 0h1' }]];
|
|
|
|
expect(toLucideIconData('AirVent', iconNode)).toEqual({
|
|
name: 'air-vent',
|
|
size: 24,
|
|
node: iconNode,
|
|
});
|
|
});
|
|
|
|
it('adds aliases when provided for legacy input', () => {
|
|
const iconNode: LucideIconNode[] = [['path', { d: 'M0 0h1' }]];
|
|
|
|
expect(toLucideIconData('AirVent', iconNode, ['vent'])).toEqual({
|
|
name: 'air-vent',
|
|
size: 24,
|
|
node: iconNode,
|
|
aliases: ['vent'],
|
|
});
|
|
});
|
|
|
|
it('throws when icon node is missing for legacy string input', () => {
|
|
expect(() => toLucideIconData('AirVent', undefined as never)).toThrowError(
|
|
'[lucide]: iconNode is required when icon name is used',
|
|
);
|
|
});
|
|
});
|