-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlaunchpadSpec.js
78 lines (65 loc) · 2.29 KB
/
launchpadSpec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
describe('launchpad', function(){
it('should exist', function(){
expect(launchpad).toBeDefined();
});
it('should have a version', function(){
expect(launchpad.version).toBeDefined();
});
describe('.defaults', function(){
it('should exist', function(){
expect(launchpad.defaults).toBeDefined();
});
describe('.midiAdapterFactory', function(){
it('should exist', function(){
expect(launchpad.defaults.midiAdapterFactory).toBeDefined();
});
it('should be a function', function(){
expect(typeof launchpad.defaults.midiAdapterFactory).toBe('function');
});
});
describe('.name', function(){
it('should exist', function(){
expect(launchpad.defaults.name).toBeDefined();
});
it('should be \'Launchpad Mini\'', function(){
expect(launchpad.defaults.name).toBe('Launchpad Mini');
});
});
describe('.sysex', function(){
it('should exist', function(){
expect(launchpad.defaults.sysex).toBeDefined();
});
it('should be false', function(){
expect(launchpad.defaults.sysex).toBe(false);
});
});
});
describe('#connect', function(){
it('should be a function', function(){
expect(typeof launchpad.connect).toBe('function');
});
it('should return a Promise', function(done){
var expectedResult = true;
var p = launchpad.connect({
midiAdapterFactory: function(accept, reject){
accept(expectedResult);
}
});
p.then(function(result){
expect(result).toBe(expectedResult);
done();
});
});
it('should set context of midiAdapterFactory to options', function(done){
var p = launchpad.connect({
midiAdapterFactory: function(accept, reject){
accept(this.name);
}
});
p.then(function(result){
expect(result).toBe(launchpad.defaults.name);
done();
});
});
});
});