Skip to content

Commit

Permalink
fix: lint fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
afarago committed Oct 19, 2024
1 parent 8bb9017 commit c696d1f
Showing 1 changed file with 25 additions and 22 deletions.
47 changes: 25 additions & 22 deletions src/ble-pybricks-service/sagas.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ describe('command encoder', () => {
],
[
'start user program with slot',
sendStartUserProgramCommand(0, 0x2A),
sendStartUserProgramCommand(0, 0x2a),
[
0x01, // start user program command
0x2A, // program slot
0x2a, // program slot
],
],
[
Expand Down Expand Up @@ -94,11 +94,11 @@ describe('command encoder', () => {
],
[
'write appdata',
sendWriteAppDataCommand(0, 0x2A, new Uint8Array([1, 2, 3, 4]).buffer),
sendWriteAppDataCommand(0, 0x2a, new Uint8Array([1, 2, 3, 4]).buffer),
[
0x07, // write appdata command
0x00, // offset msb 16bit
0x2A, // offset lsb 16bit
0x2a, // offset lsb 16bit
0x01, // payload start
0x02,
0x03,
Expand Down Expand Up @@ -237,28 +237,31 @@ describe('event decoder', () => {
]).buffer,
),
true,
false
false,
],
])('decode %s event', async (_n, message, expected, isEqual = true, isStrictlyEqual = true) => {
const saga = new AsyncSaga(blePybricksService);
const notification = new Uint8Array(message);
])(
'decode %s event',
async (_n, message, expected, isEqual = true, isStrictlyEqual = true) => {
const saga = new AsyncSaga(blePybricksService);
const notification = new Uint8Array(message);

saga.put(didNotifyEvent(new DataView(notification.buffer)));
saga.put(didNotifyEvent(new DataView(notification.buffer)));

const action = await saga.take();
if (isEqual) {
expect(action).toEqual(expected);
} else {
expect(action).not.toEqual(expected);
}
if (isStrictlyEqual) {
expect(action).toStrictEqual(expected);
} else {
expect(action).not.toStrictEqual(expected);
}
const action = await saga.take();
if (isEqual) {
expect(action).toEqual(expected);
} else {
expect(action).not.toEqual(expected);
}
if (isStrictlyEqual) {
expect(action).toStrictEqual(expected);
} else {
expect(action).not.toStrictEqual(expected);
}

await saga.end();
});
await saga.end();
},
);

test.each([
[
Expand Down

0 comments on commit c696d1f

Please sign in to comment.