Add native Roku integration
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import { expect, tap } from '@git.zone/tstest/tapbundle';
|
||||
import { RokuMapper } from '../../ts/integrations/roku/index.js';
|
||||
|
||||
const snapshot = {
|
||||
deviceInfo: {
|
||||
deviceId: 'roku-ecp-123456',
|
||||
vendorName: 'Roku',
|
||||
modelName: 'Roku Streaming Stick',
|
||||
friendlyDeviceName: 'Living Room Roku',
|
||||
powerMode: 'PowerOn',
|
||||
},
|
||||
apps: [
|
||||
{ id: '12', name: 'Netflix' },
|
||||
{ id: '13', name: 'Prime Video' },
|
||||
],
|
||||
activeApp: { id: '12', name: 'Netflix' },
|
||||
};
|
||||
|
||||
tap.test('maps Roku ECP snapshots to media devices and entities', async () => {
|
||||
const devices = RokuMapper.toDevices(snapshot);
|
||||
const entities = RokuMapper.toEntities(snapshot);
|
||||
expect(devices[0].id).toEqual('roku.device.roku_ecp_123456');
|
||||
expect(devices[0].state.some((stateArg) => stateArg.featureId === 'active_app' && stateArg.value === 'Netflix')).toBeTrue();
|
||||
expect(entities[0].platform).toEqual('media_player');
|
||||
expect(entities[0].state).toEqual('on');
|
||||
});
|
||||
|
||||
export default tap.start();
|
||||
Reference in New Issue
Block a user