Skip to content

Commit

Permalink
Added watcher tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jazz-soft committed May 22, 2019
1 parent 9c01b43 commit 5e25b61
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test/engine2.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,5 +125,9 @@ describe('Engine: extension', function() {
test.widget_midi_out();
test.virtual_midi_in();
test.virtual_midi_out();
test.add_midi_in();
test.add_midi_out();
test.remove_midi_in();
test.remove_midi_out();
it('Dummy AudioContext', function() { DOM.dispatchEvent({ name: 'keydown' }); });
});
64 changes: 64 additions & 0 deletions test/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,5 +101,69 @@ module.exports = function(JZZ, PARAMS, DRIVER) {
});
},

add_midi_in: function() {
it('Add MIDI-In', function(done) {
var name = 'Virtual MIDI-In to add';
var src = DRIVER.MidiSrc(name);
engine.refresh().onChange(function(arg) {
assert.equal(arg.inputs.added[0].name, name);
engine.onChange().disconnect();
src.disconnect();
done();
});
engine.refresh().and(function() {
src.connect();
});
});
},

add_midi_out: function() {
it('Add MIDI-Out', function(done) {
var name = 'Virtual MIDI-Out to add';
var dst = DRIVER.MidiDst(name);
engine.refresh().onChange(function(arg) {
assert.equal(arg.outputs.added[0].name, name);
engine.onChange().disconnect();
dst.disconnect();
done();
});
engine.refresh().and(function() {
dst.connect();
});
});
},

remove_midi_in: function() {
it('Remove MIDI-In', function(done) {
var name = 'Virtual MIDI-In to remove';
var src = DRIVER.MidiSrc(name);
src.connect();
engine.refresh().onChange(function(arg) {
assert.equal(arg.inputs.removed[0].name, name);
engine.onChange().disconnect();
done();
});
engine.refresh().and(function() {
src.disconnect();
});
});
},

remove_midi_out: function() {
it('Remove MIDI-Out', function(done) {
var name = 'Virtual MIDI-Out to remove';
var dst = DRIVER.MidiDst(name);
dst.connect();
engine.refresh().onChange(function(arg) {
assert.equal(arg.outputs.removed[0].name, name);
engine.onChange().disconnect();
done();
});
engine.refresh().and(function() {
dst.disconnect();
});
});
}

};
};

0 comments on commit 5e25b61

Please sign in to comment.