All files / sportident-testbench-shell/src/commands getDirectOrRemoteStation.ts

27.27% Statements 3/11
0% Branches 0/3
0% Functions 0/1
20% Lines 2/10

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18  1x   1x                            
import {ISiDevice, ISiDeviceDriverData} from 'sportident/lib/SiDevice/ISiDevice';
import {CoupledSiStation, SiMainStation} from 'sportident/lib/SiStation';
 
export const getDirectOrRemoteStation = (userChoice: string, device: ISiDevice<ISiDeviceDriverData<unknown>>): CoupledSiStation|SiMainStation|undefined => {
    const isRemoteByInput: {[ident: string]: boolean} = {
        remote: true,
        direct: false,
    };
    const isRemote = isRemoteByInput[userChoice];
    let station = undefined;
    if (isRemote === true) {
        station = CoupledSiStation.fromSiDevice(device);
    } else Iif (isRemote === false) {
        station = SiMainStation.fromSiDevice(device);
    }
    return station;
};