-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
35 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,39 @@ | ||
const assert = require('assert'); | ||
const { ValueViewerSymbol } = require("@runkit/value-viewer"); | ||
const rkmidi = require('..'); | ||
const JZZ = require('jzz'); | ||
require('jzz-midi-smf')(JZZ); | ||
|
||
describe('smoke test', function() { | ||
it('it works!', function() { | ||
var smf = new JZZ.MIDI.SMF(0, 96); | ||
var trk = new JZZ.MIDI.SMF.MTrk(); | ||
smf.push(trk); | ||
trk.smfBPM(90).ch(0).program(16) | ||
.tick(96).noteOn('C6', 127).tick(96).noteOn('Eb6', 127) | ||
.tick(96).noteOn('G6', 127).tick(96).noteOn('C7', 127) | ||
.tick(192).noteOff('C6').noteOff('Eb6').noteOff('G6') | ||
.noteOff('C7').tick(96).smfEndOfTrack(); | ||
var data = rkmidi(smf); | ||
assert.equal(data.ValueViewerSymbol.title, 'MIDI Player'); | ||
var clip = new JZZ.MIDI.Clip(); | ||
var smf1 = new JZZ.MIDI.SMF(0, 96); | ||
var smf2 = new JZZ.MIDI.SMF(1, 24, 16); | ||
var trk1 = new JZZ.MIDI.SMF.MTrk(); | ||
var trk2 = new JZZ.MIDI.SMF.Chunk('JUNK', 'JUNK'); | ||
smf1.push(trk1); | ||
smf2.push(trk1); | ||
smf2.push(trk2); | ||
trk1.noteOn(0, 'C6', 127).tick(96).noteOff(0, 'C6'); | ||
clip.noteOn(0, 0, 'C6', 127).tick(96).noteOff(0, 0, 'C6'); | ||
|
||
describe('MIDI files', function() { | ||
it('empty', function() { | ||
var data = rkmidi(); | ||
assert.equal(data[ValueViewerSymbol].title, 'MIDI Player'); | ||
}); | ||
it('smf1', function() { | ||
var data = rkmidi(smf1); | ||
assert.equal(data[ValueViewerSymbol].title, 'MIDI Player'); | ||
}); | ||
it('smf2', function() { | ||
var data = rkmidi(smf2); | ||
assert.equal(data[ValueViewerSymbol].title, 'MIDI Player'); | ||
}); | ||
it('clip', function() { | ||
var data = rkmidi(clip); | ||
assert.equal(data[ValueViewerSymbol].title, 'MIDI Player'); | ||
}); | ||
it('error', function() { | ||
var data = rkmidi('error'); | ||
assert.equal(data[ValueViewerSymbol].title, 'MIDI Player'); | ||
}); | ||
}); |