This repository has been archived by the owner on May 29, 2023. It is now read-only.
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
2 changed files
with
25 additions
and
33 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,46 @@ | ||
import {TestBed} from '@angular/core/testing'; | ||
import {NAVIGATOR} from '@ng-web-apis/common'; | ||
import {MIDI_ACCESS} from '../midi-access'; | ||
import {SYSEX} from '../sysex'; | ||
|
||
describe('MIDI_ACCESS', () => { | ||
// TODO: Wait before remote debugging allows midi access | ||
beforeAll(done => { | ||
setTimeout(() => { | ||
done(); | ||
}, 4000); | ||
}); | ||
const navigatorMock = jasmine.createSpyObj(['requestMIDIAccess']); | ||
|
||
it('SYSEX is false by default', () => { | ||
TestBed.configureTestingModule({ | ||
providers: [ | ||
{ | ||
provide: NAVIGATOR, | ||
useValue: navigatorMock, | ||
}, | ||
], | ||
}); | ||
|
||
TestBed.get(MIDI_ACCESS); | ||
|
||
it('SYSEX is false by default', done => { | ||
TestBed.get(MIDI_ACCESS).then((midiAccess: any) => { | ||
expect(midiAccess.sysexEnabled).toBe(false); | ||
done(); | ||
expect(navigatorMock.requestMIDIAccess.calls.mostRecent().args[0]).toEqual({ | ||
sysex: false, | ||
}); | ||
}); | ||
|
||
it('SYSEX is set to true', done => { | ||
it('SYSEX is set to true', () => { | ||
TestBed.configureTestingModule({ | ||
providers: [ | ||
{ | ||
provide: NAVIGATOR, | ||
useValue: navigatorMock, | ||
}, | ||
{ | ||
provide: SYSEX, | ||
useValue: true, | ||
}, | ||
], | ||
}); | ||
|
||
TestBed.get(MIDI_ACCESS).then((midiAccess: any) => { | ||
expect(midiAccess.sysexEnabled).toBe(true); | ||
done(); | ||
TestBed.get(MIDI_ACCESS); | ||
|
||
expect(navigatorMock.requestMIDIAccess.calls.mostRecent().args[0]).toEqual({ | ||
sysex: true, | ||
}); | ||
}); | ||
}); |