switch to inline snapshots in tests

This commit is contained in:
David Lechner
2021-01-22 15:58:10 -06:00
parent b1efa04947
commit e229f08ffd
4 changed files with 34 additions and 44 deletions
@@ -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",
}
`;
-9
View File
@@ -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",
]
`;
+27 -3
View File
@@ -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);
+7 -1
View File
@@ -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();
});