Skip to content

Commit 77e97c2

Browse files
committed
passing tests and fixing lint
1 parent 56be2e3 commit 77e97c2

8 files changed

+98
-7
lines changed

__tests__/PinsAnalogItem.test.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ import PinsAnalogItem from "../src/components/PinsAnalogItem"
44

55
describe("PinsAnalogItem", () => {
66
test("Rendering 1", () => {
7-
const tree = renderer.create(<PinsAnalogItem />).toJSON()
7+
const tree = renderer
8+
.create(<PinsAnalogItem gpio_analog={{ duty: 255 }} />)
9+
.toJSON()
810
expect(tree).toMatchSnapshot()
911
})
1012
})

__tests__/PinsDigitalItem.test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ import PinsDigitalItem from "../src/components/PinsDigitalItem"
55
describe("PinsDigitalItem", () => {
66
test("Rendering 1", () => {
77
const tree = renderer
8-
.create(<PinsDigitalItem pinNumber={0} isEnabled={false} />)
8+
.create(<PinsDigitalItem gpio={{ pinNumber: 0, isEnabled: false }} />)
99
.toJSON()
1010
expect(tree).toMatchSnapshot()
1111
})
1212
test("Rendering 2", () => {
1313
const tree = renderer
14-
.create(<PinsDigitalItem pinNumber={0} isEnabled={true} />)
14+
.create(<PinsDigitalItem gpio={{ pinNumber: 0, isEnabled: true }} />)
1515
.toJSON()
1616
expect(tree).toMatchSnapshot()
1717
})

__tests__/__snapshots__/Editor.test.js.snap

+44
Original file line numberDiff line numberDiff line change
@@ -1350,6 +1350,28 @@ exports[`Editor Rendering 1 1`] = `
13501350
>
13511351
12
13521352
</div>
1353+
<div
1354+
style={
1355+
{
1356+
"alignItems": "center",
1357+
"backgroundColor": "red",
1358+
"borderRadius": "16px",
1359+
"color": "white",
1360+
"cursor": "default",
1361+
"display": "flex",
1362+
"float": "left",
1363+
"fontFamily": "Arial",
1364+
"fontSize": "11px",
1365+
"height": "16px",
1366+
"justifyContent": "center",
1367+
"marginLeft": "4px",
1368+
"marginTop": "4px",
1369+
"width": "16px",
1370+
}
1371+
}
1372+
>
1373+
13
1374+
</div>
13531375
</div>
13541376
</div>
13551377
</div>
@@ -1505,6 +1527,28 @@ exports[`Editor Rendering 1 1`] = `
15051527
>
15061528
0
15071529
</div>
1530+
<div
1531+
style={
1532+
{
1533+
"alignItems": "center",
1534+
"backgroundColor": "black",
1535+
"borderRadius": "16px",
1536+
"color": "white",
1537+
"cursor": "default",
1538+
"display": "flex",
1539+
"float": "left",
1540+
"fontFamily": "Arial",
1541+
"fontSize": "11px",
1542+
"height": "16px",
1543+
"justifyContent": "center",
1544+
"marginLeft": "4px",
1545+
"marginTop": "4px",
1546+
"width": "40px",
1547+
}
1548+
}
1549+
>
1550+
0
1551+
</div>
15081552
</div>
15091553
</div>
15101554
</div>

__tests__/__snapshots__/PinsAnalogBar.test.js.snap

+22
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,28 @@ exports[`PinsAnalogBar Rendering 1 1`] = `
153153
>
154154
0
155155
</div>
156+
<div
157+
style={
158+
{
159+
"alignItems": "center",
160+
"backgroundColor": "black",
161+
"borderRadius": "16px",
162+
"color": "white",
163+
"cursor": "default",
164+
"display": "flex",
165+
"float": "left",
166+
"fontFamily": "Arial",
167+
"fontSize": "11px",
168+
"height": "16px",
169+
"justifyContent": "center",
170+
"marginLeft": "4px",
171+
"marginTop": "4px",
172+
"width": "40px",
173+
}
174+
}
175+
>
176+
0
177+
</div>
156178
</div>
157179
</div>
158180
</div>

__tests__/__snapshots__/PinsAnalogItem.test.js.snap

+3-1
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,7 @@ exports[`PinsAnalogItem Rendering 1 1`] = `
2020
"width": "40px",
2121
}
2222
}
23-
/>
23+
>
24+
255
25+
</div>
2426
`;

__tests__/__snapshots__/PinsDigitalBar.test.js.snap

+22
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,28 @@ exports[`PinsDigitalBar Rendering 1 1`] = `
329329
>
330330
12
331331
</div>
332+
<div
333+
style={
334+
{
335+
"alignItems": "center",
336+
"backgroundColor": "red",
337+
"borderRadius": "16px",
338+
"color": "white",
339+
"cursor": "default",
340+
"display": "flex",
341+
"float": "left",
342+
"fontFamily": "Arial",
343+
"fontSize": "11px",
344+
"height": "16px",
345+
"justifyContent": "center",
346+
"marginLeft": "4px",
347+
"marginTop": "4px",
348+
"width": "16px",
349+
}
350+
}
351+
>
352+
13
353+
</div>
332354
</div>
333355
</div>
334356
</div>

src/components/Toolbar.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ const Toolbar = () => {
6969
isInput: false,
7070
duty: 0,
7171
}))
72-
/* eslint-enable no-unused-vars */
7372

7473
const newFile = () => {
7574
if (editorIsDirty()) {

src/utils/interpreter.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ const myWorkerTimestamp = Date.now()
77
const startSimulator = (
88
setShowLoading: (state: boolean) => void,
99
setSimulatorRunning: (state: boolean) => void,
10-
handleSetDigitalPins: (index: any, state: any) => void,
11-
handleSetAnalogPins: (index: any, duty: any) => void,
10+
handleSetDigitalPins: (index: number, state: boolean) => void,
11+
handleSetAnalogPins: (index: number, duty: number) => void,
1212
// eslint-disable-next-line @typescript-eslint/no-explicit-any
1313
setOutputData: any
1414
) => {

0 commit comments

Comments
 (0)