Skip to content

Commit ff46ac7

Browse files
committed
fix(selectInputsForOutput): send correct message
We were previously sending the result of Array.unshift, which returns the length of the new array, rather than the new array. This change sends the correct message. fix #4
1 parent 9e75a70 commit ff46ac7

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

lib/wekinator-node.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,14 +185,14 @@
185185
var address = '/selectInputsForOutput';
186186
self.queuePush({
187187
address: self.controlEndpoint+address,
188-
args: inputs.unshift(output)
188+
args: [output].concat(inputs)
189189
});
190190
};
191191
wekinatorNode.prototype.trainOnData = function(data){
192192
self.startRecording();
193193
for(var i = 0; i < data.length; i++){
194-
// We're not *too* worried about the input arriving before the output
195-
// because we handle queueing internally.
194+
// We're not *too* worried about the input arriving before the output
195+
// because we handle queueing internally.
196196
self.outputs(data[i].outputs);
197197
self.inputs(data[i].inputs);
198198
}

test/wekinator-node.test.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,11 +237,10 @@ test('selectInputsForOutput sends correct OSC message', function() {
237237

238238
wn.connect(() => {
239239
expect(wn.selectInputsForOutput).toThrow();
240-
wn.selectInputsForOutput(0,[1,2,-3]);
241-
//TODO: I believe this arg is a bug, see #4
240+
wn.selectInputsForOutput(0,[1,2,3]);
242241
expect(oscMock.UDPPort.prototype.send.mock.calls[0][0]).toEqual({
243242
address: "/wekinator/control/selectInputsForOutput",
244-
args: 4
243+
args: [0,1,2,3]
245244
});
246245
});
247246
});

0 commit comments

Comments
 (0)