mirror of
https://github.com/pybricks/pybricks-code.git
synced 2026-09-14 10:35:11 +00:00
ble-pybricks-service: add some tests
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
// Copyright (c) 2020 The Pybricks Authors
|
||||
|
||||
import { AsyncSaga } from '../../test';
|
||||
import { eventProtocolError } from '../ble-pybricks-service/actions';
|
||||
import { didFailToWrite } from '../ble-uart/actions';
|
||||
import {
|
||||
BleDeviceFailToConnectReasonType,
|
||||
@@ -46,6 +47,16 @@ test('bleDataDidFailToWrite', async () => {
|
||||
await saga.end();
|
||||
});
|
||||
|
||||
test('eventProtocolError', async () => {
|
||||
const saga = new AsyncSaga(errorLog);
|
||||
|
||||
console.error = jest.fn();
|
||||
saga.put(eventProtocolError(new Error('test error')));
|
||||
expect(console.error).toHaveBeenCalledTimes(1);
|
||||
|
||||
await saga.end();
|
||||
});
|
||||
|
||||
test('bootloaderDidFailToConnect', async () => {
|
||||
const saga = new AsyncSaga(errorLog);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user