From e229f08ffdb3cf215a2a9ca920ca4615ffdbc43f Mon Sep 17 00:00:00 2001 From: David Lechner Date: Fri, 22 Jan 2021 11:41:46 -0600 Subject: [PATCH] switch to inline snapshots in tests --- .../__snapshots__/flash-firmware.test.ts.snap | 31 ------------------- src/sagas/__snapshots__/mpy.test.ts.snap | 9 ------ src/sagas/flash-firmware.test.ts | 30 ++++++++++++++++-- src/sagas/mpy.test.ts | 8 ++++- 4 files changed, 34 insertions(+), 44 deletions(-) delete mode 100644 src/sagas/__snapshots__/flash-firmware.test.ts.snap delete mode 100644 src/sagas/__snapshots__/mpy.test.ts.snap diff --git a/src/sagas/__snapshots__/flash-firmware.test.ts.snap b/src/sagas/__snapshots__/flash-firmware.test.ts.snap deleted file mode 100644 index 77e153cd..00000000 --- a/src/sagas/__snapshots__/flash-firmware.test.ts.snap +++ /dev/null @@ -1,31 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`flashFirmware normal flow 1`] = ` -Object { - "options": Array [ - "-mno-unicode", - ], - "script": "print(\\"test\\")", - "type": "mpy.action.compile", -} -`; - -exports[`flashFirmware user supplied firmware.zip success 1`] = ` -Object { - "options": Array [ - "-mno-unicode", - ], - "script": "print(\\"test\\")", - "type": "mpy.action.compile", -} -`; - -exports[`flashFirmware user supplied main.py 1`] = ` -Object { - "options": Array [ - "-mno-unicode", - ], - "script": "print(\\"test\\")", - "type": "mpy.action.compile", -} -`; diff --git a/src/sagas/__snapshots__/mpy.test.ts.snap b/src/sagas/__snapshots__/mpy.test.ts.snap deleted file mode 100644 index 1e4167cd..00000000 --- a/src/sagas/__snapshots__/mpy.test.ts.snap +++ /dev/null @@ -1,9 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`compiler error works 1`] = ` -Array [ - "Traceback (most recent call last):", - " File \\"main.py\\", line 1", - "SyntaxError: invalid syntax", -] -`; diff --git a/src/sagas/flash-firmware.test.ts b/src/sagas/flash-firmware.test.ts index d03bb64b..5fd20359 100644 --- a/src/sagas/flash-firmware.test.ts +++ b/src/sagas/flash-firmware.test.ts @@ -92,7 +92,15 @@ describe('flashFirmware', () => { // then compile main.py to .mpy action = await saga.take(); - expect(action).toMatchSnapshot(); + expect(action).toMatchInlineSnapshot(` + Object { + "options": Array [ + "-mno-unicode", + ], + "script": "print(\\"test\\")", + "type": "mpy.action.compile", + } + `); const mpySize = 20; const mpyBinaryData = new Uint8Array(mpySize); @@ -209,7 +217,15 @@ describe('flashFirmware', () => { // the first step is to compile main.py to .mpy let action = await saga.take(); - expect(action).toMatchSnapshot(); + expect(action).toMatchInlineSnapshot(` + Object { + "options": Array [ + "-mno-unicode", + ], + "script": "print(\\"test\\")", + "type": "mpy.action.compile", + } + `); const mpySize = 20; const mpyBinaryData = new Uint8Array(mpySize); @@ -452,7 +468,15 @@ describe('flashFirmware', () => { // then compile main.py to .mpy action = await saga.take(); - expect(action).toMatchSnapshot(); + expect(action).toMatchInlineSnapshot(` + Object { + "options": Array [ + "-mno-unicode", + ], + "script": "print(\\"test\\")", + "type": "mpy.action.compile", + } + `); const mpySize = 20; const mpyBinaryData = new Uint8Array(mpySize); diff --git a/src/sagas/mpy.test.ts b/src/sagas/mpy.test.ts index 141a0f62..1ca2232d 100644 --- a/src/sagas/mpy.test.ts +++ b/src/sagas/mpy.test.ts @@ -37,7 +37,13 @@ test('compiler error works', async () => { const action = await saga.take(); expect(action.type).toBe(MpyActionType.DidFailToCompile); const { err } = action as MpyDidFailToCompileAction; - expect(err).toMatchSnapshot(); + expect(err).toMatchInlineSnapshot(` + Array [ + "Traceback (most recent call last):", + " File \\"main.py\\", line 1", + "SyntaxError: invalid syntax", + ] + `); await saga.end(); });