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:
commit
4a04c5c7c7
|
|
@ -1,11 +1,18 @@
|
||||||
import { describe, it, expect } from 'vitest';
|
import { describe, it, expect } from 'vitest';
|
||||||
import metadata from '../../public/components-metadata.json';
|
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', () => {
|
describe('component metadata — BMP280 entry', () => {
|
||||||
it('is registered with id "bmp280" and tagName "velxio-bmp280"', () => {
|
it('is registered with id "bmp280" and tagName "velxio-bmp280"', () => {
|
||||||
const entry = (metadata as Array<Record<string, unknown>>).find(
|
const components = (metadata as { components: ComponentMetadataEntry[] }).components;
|
||||||
(c) => c.id === 'bmp280',
|
const entry = components.find((c) => c.id === 'bmp280');
|
||||||
);
|
|
||||||
expect(entry, 'BMP280 missing from components-metadata.json').toBeDefined();
|
expect(entry, 'BMP280 missing from components-metadata.json').toBeDefined();
|
||||||
expect(entry!.tagName).toBe('velxio-bmp280');
|
expect(entry!.tagName).toBe('velxio-bmp280');
|
||||||
expect(entry!.category).toBe('sensor');
|
expect(entry!.category).toBe('sensor');
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue