Merge pull request #158 from davidmonterocrespo24/fix-bmp280-test-metadata-shape

test(metadata): drill into components array for BMP280 lookup
This commit is contained in:
David Montero Crespo 2026-05-09 18:54:54 -03:00 committed by GitHub
commit 4a04c5c7c7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 3 deletions

View File

@ -1,11 +1,18 @@
import { describe, it, expect } from 'vitest';
import metadata from '../../public/components-metadata.json';
interface ComponentMetadataEntry {
id: string;
tagName: string;
category: string;
pinCount: number;
[key: string]: unknown;
}
describe('component metadata — BMP280 entry', () => {
it('is registered with id "bmp280" and tagName "velxio-bmp280"', () => {
const entry = (metadata as Array<Record<string, unknown>>).find(
(c) => c.id === 'bmp280',
);
const components = (metadata as { components: ComponentMetadataEntry[] }).components;
const entry = components.find((c) => c.id === 'bmp280');
expect(entry, 'BMP280 missing from components-metadata.json').toBeDefined();
expect(entry!.tagName).toBe('velxio-bmp280');
expect(entry!.category).toBe('sensor');