From b1883a9d1c8b8db3748c6ac3406792894daa6571 Mon Sep 17 00:00:00 2001 From: David Lechner Date: Fri, 22 Jan 2021 16:51:42 -0600 Subject: [PATCH] make sure we are getting coverage of checksum messages --- src/sagas/flash-firmware.test.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/sagas/flash-firmware.test.ts b/src/sagas/flash-firmware.test.ts index fd8dce38..5d0e3c37 100644 --- a/src/sagas/flash-firmware.test.ts +++ b/src/sagas/flash-firmware.test.ts @@ -120,7 +120,9 @@ describe('flashFirmware', () => { } `); - const mpySize = 20; + // this makes total firmware size 140 bytes to check for + // https://github.com/pybricks/support/issues/178 + const mpySize = 40 - 8; const mpyBinaryData = new Uint8Array(mpySize); saga.put(didCompile(mpyBinaryData)); @@ -167,6 +169,7 @@ describe('flashFirmware', () => { // last payload is sent, otherwise the hub gets confused. if (offset + 14 >= totalFirmwareSize) { + expect(count).toBe(10); break; } @@ -849,7 +852,9 @@ describe('flashFirmware', () => { } `); - const mpySize = 20; + // make sure that total firmware size is big enough that checksum + // is called at least once + const mpySize = 100; const mpyBinaryData = new Uint8Array(mpySize); saga.put(didCompile(mpyBinaryData)); @@ -914,6 +919,7 @@ describe('flashFirmware', () => { // last payload is sent, otherwise the hub gets confused. if (offset + 14 >= totalFirmwareSize) { + expect(count).toBeGreaterThan(10); break; }