Skip to content

Commit

Permalink
fixup! fix(connect): flush device with Cancel command on first intera…
Browse files Browse the repository at this point in the history
…ction to prevent unexpected messages being read
  • Loading branch information
mroz22 committed Jan 24, 2025
1 parent 434f9c5 commit 3792064
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions packages/connect/src/device/__tests__/DeviceList.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,15 +280,22 @@ describe('DeviceList', () => {
let readCount = 0;
const transport = createTestTransport({
read: () => {
let features = '3f232300110000000c1002180020006000aa010154'; // 2.0.0
if (readCount > 0) {
features = `3f232300110000000c10021800200${1}6000aa010154`; // 2.0.1
let res = '';
if (readCount === 0) {
// cancel response
res = '3f2323000300000000000000000000000000000000';
} else if (readCount === 1) {
// features
res = '3f232300110000000c1002180020006000aa010154'; // 2.0.0;
} else {
// features
res = `3f232300110000000c10021800200${1}6000aa010154`; // 2.0.1
}
readCount++;

return Promise.resolve({
success: true,
payload: Buffer.from(features, 'hex'),
payload: Buffer.from(res, 'hex'),
});
},
});
Expand Down

0 comments on commit 3792064

Please sign in to comment.