Skip to content

Commit

Permalink
Merge pull request #979 from lbrooks/focus-tests
Browse files Browse the repository at this point in the history
cleanup: Remove unused methods of Focus.ts add test coverage.
  • Loading branch information
alexpargon authored Feb 7, 2025
2 parents 26474ed + 509f3a1 commit e38e376
Show file tree
Hide file tree
Showing 9 changed files with 401 additions and 272 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@
"@radix-ui/react-toggle-group": "^1.0.4",
"@radix-ui/react-tooltip": "^1.0.7",
"@serialport/parser-delimiter": "^12.0.0",
"@serialport/stream": "12.0.0",
"@types/react-color": "^3.0.11",
"@types/w3c-web-hid": "^1.0.3",
"@xstate/react": "^4.1.1",
Expand Down
4 changes: 3 additions & 1 deletion src/api/flash/RaiseTools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,9 @@ export const updateFirmware = async (filename: string[], stateUpdate: any, path:
stateUpdate("neuron", 0);

const focus = Focus.getInstance();
if (focus.closed || focus._port === undefined) await focus.open(path, device, null);
if (focus.closed || focus._port === undefined) {
await focus.open(path, device);
}
await new Promise((resolve, reject) => {
arduino.flash(filename, stateUpdate, async (err: any, result: any) => {
if (err) reject(new Error(`Flash error ${result}`));
Expand Down
8 changes: 5 additions & 3 deletions src/api/flash/raiseFlasher/flash.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,9 @@ export class FlashRaise {
// log.info(JSON.stringify(focus));
return new Promise(async (resolve, reject) => {
try {
if (focus.closed) await focus.open(this.currentPort.path, this.currentPort.device, null);
if (focus.closed) {
await focus.open(this.currentPort.path, this.currentPort.device);
}

stateUpdate("neuron", 0);
await arduino.flash(filename, stateUpdate, async (err, result) => {
Expand Down Expand Up @@ -323,11 +325,11 @@ export class FlashRaise {
log.info(backup);
if (backup === undefined || backup.length === 0) {
this.foundDevices();
await focus.open(this.currentPort.path, this.currentPort.device.info, null);
await focus.open(this.currentPort.path, this.currentPort.device.info);
return true;
}
try {
await focus.open(this.currentPort.path, this.currentPort.device.info, null);
await focus.open(this.currentPort.path, this.currentPort.device.info);
for (let i = 0; i < backup.length; i++) {
let val = backup[i].data;
// Boolean values need to be sent as int
Expand Down
3 changes: 0 additions & 3 deletions src/api/focus/Focus.ctx.ts

This file was deleted.

51 changes: 0 additions & 51 deletions src/api/focus/Focus.mocks.ts

This file was deleted.

77 changes: 0 additions & 77 deletions src/api/focus/Focus.spec.ts

This file was deleted.

Loading

0 comments on commit e38e376

Please sign in to comment.