* feat: kboot package * feat: kboot package * fix: wait 1 sec after device is available * test: fix unit test * refactor: clean unused codes * doc: improve readme.md * doc: improve readme.md * test: fix unit test * chore: fix lint settings * style: fix linting issues
17 lines
649 B
TypeScript
17 lines
649 B
TypeScript
import { CommandOption, Commands } from '../../../src';
|
|
import { encodeCommandOption } from '../../../src/util';
|
|
|
|
describe('usb encodeCommandOption', () => {
|
|
it('should convert correctly', () => {
|
|
const option: CommandOption = {
|
|
command: Commands.GetProperty,
|
|
params: [1, 0, 0, 0, 0, 0, 0, 0]
|
|
};
|
|
|
|
const result = encodeCommandOption(option);
|
|
// tslint:disable-next-line:max-line-length
|
|
const expected = [1, 0, 0x0c, 0, 0x07, 0x00, 0x00, 0x02, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
|
|
expect(result).toEqual(expected);
|
|
});
|
|
});
|