Skip to content

Commit

Permalink
Improvements discovered while reviewing with Bronley
Browse files Browse the repository at this point in the history
  • Loading branch information
triwav committed Sep 11, 2023
1 parent 1f4887d commit c8991b2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/viewProviders/BaseWebviewViewProvider.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as vscode from 'vscode';
import * as path from 'path';
import * as fsExtra from 'fs-extra';
import type { RequestType } from 'roku-test-automation';
import type { AsyncSubscription, Event } from '@parcel/watcher';
import type { ChannelPublishedEvent } from 'roku-debug';
import { vscodeContextManager } from '../managers/VscodeContextManager';
Expand Down Expand Up @@ -86,7 +87,7 @@ export abstract class BaseWebviewViewProvider implements vscode.WebviewViewProvi
}
}

protected addMessageCommandCallback(command: string, callback: (message) => Promise<boolean>) {
protected addMessageCommandCallback(command: ViewProviderCommand | VscodeCommand | RequestType, callback: (message) => Promise<boolean>) {
this.messageCommandCallbacks[command] = callback;
}

Expand Down
5 changes: 3 additions & 2 deletions src/viewProviders/RokuCommandsViewProvider.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { expect } from 'chai';
import * as sinonImport from 'sinon';
import { vscode } from '../mockVscode.spec';
import { RokuCommandsViewProvider } from './RokuCommandsViewProvider';
import { VscodeCommand } from '../commands/VscodeCommand';

let Module = require('module');
const { require: oldRequire } = Module.prototype;
Expand Down Expand Up @@ -52,9 +53,9 @@ describe('RokuCommandsViewProvider', () => {

expect(typeof callback).to.equal('function');
const fake = sinonImport.fake.returns(Promise.resolve(true));
provider['addMessageCommandCallback']('importRegistry', fake);
provider['addMessageCommandCallback'](VscodeCommand.rokuRegistryImportRegistry, fake);
callback({
command: 'importRegistry',
command: VscodeCommand.rokuRegistryImportRegistry,
context: {}
});
expect(fake.calledOnce).to.be.true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
function addStep() {
steps.push({
type: 'sendKeyPress',
value: ''
value: 'Ok'
});
storeConfigs(steps);
Expand Down Expand Up @@ -143,7 +143,7 @@
} else {
steps = [{
type: 'sleep',
value: '4'
value: '8'
}];
}
loading = false;
Expand All @@ -152,7 +152,6 @@
let lastStepDate = Date.now();
intermediary.observeEvent(ViewProviderEvent.onRokuAutomationConfigStepChange, (message) => {
currentRunningStep = message.context.step;
console.log('currentRunningStep', currentRunningStep);
if (currentRunningStep === -1) {
// Once we finish running all current steps, update our last step date in case we want to add any more steps
lastStepDate = Date.now();
Expand Down

0 comments on commit c8991b2

Please sign in to comment.