@@ -41,6 +41,52 @@ describe('midi.input', function() {
41
41
input . getPortName ( 999 ) . should . eql ( '' ) ;
42
42
} ) ;
43
43
} ) ;
44
+
45
+ describe ( '.openPort' , function ( ) {
46
+ var input = new Midi . input ( ) ;
47
+
48
+ it ( 'requires an argument' , function ( ) {
49
+ ( function ( ) {
50
+ input . openPort ( ) ;
51
+ } ) . should . throw ( 'First argument must be an integer' ) ;
52
+ } ) ;
53
+
54
+ it ( 'requires an integer' , function ( ) {
55
+ ( function ( ) {
56
+ input . openPort ( 'asdf' ) ;
57
+ } ) . should . throw ( 'First argument must be an integer' ) ;
58
+ } ) ;
59
+
60
+ it ( 'requires a valid port' , function ( ) {
61
+ ( function ( ) {
62
+ input . openPort ( 999 ) ;
63
+ } ) . should . throw ( 'Invalid MIDI port number' ) ;
64
+ } ) ;
65
+ } ) ;
66
+
67
+ describe ( '.openVirtualPort' , function ( ) {
68
+ var input = new Midi . input ( ) ;
69
+
70
+ it ( 'requires an argument' , function ( ) {
71
+ ( function ( ) {
72
+ input . openVirtualPort ( ) ;
73
+ } ) . should . throw ( 'First argument must be a string' ) ;
74
+ } ) ;
75
+
76
+ it ( 'requires a string' , function ( ) {
77
+ ( function ( ) {
78
+ input . openVirtualPort ( 999 ) ;
79
+ } ) . should . throw ( 'First argument must be a string' ) ;
80
+ } ) ;
81
+ } ) ;
82
+
83
+ describe ( '.closePort' , function ( ) {
84
+ var input = new Midi . input ( ) ;
85
+
86
+ it ( 'allows you to close a port that was not opened' , function ( ) {
87
+ input . closePort ( ) ;
88
+ } ) ;
89
+ } ) ;
44
90
} ) ;
45
91
46
92
describe ( 'midi.output' , function ( ) {
@@ -82,4 +128,50 @@ describe('midi.output', function() {
82
128
output . getPortName ( 999 ) . should . eql ( '' ) ;
83
129
} ) ;
84
130
} ) ;
131
+
132
+ describe ( '.openPort' , function ( ) {
133
+ var output = new Midi . output ( ) ;
134
+
135
+ it ( 'requires an argument' , function ( ) {
136
+ ( function ( ) {
137
+ output . openPort ( ) ;
138
+ } ) . should . throw ( 'First argument must be an integer' ) ;
139
+ } ) ;
140
+
141
+ it ( 'requires an integer' , function ( ) {
142
+ ( function ( ) {
143
+ output . openPort ( 'asdf' ) ;
144
+ } ) . should . throw ( 'First argument must be an integer' ) ;
145
+ } ) ;
146
+
147
+ it ( 'requires a valid port' , function ( ) {
148
+ ( function ( ) {
149
+ output . openPort ( 999 ) ;
150
+ } ) . should . throw ( 'Invalid MIDI port number' ) ;
151
+ } ) ;
152
+ } ) ;
153
+
154
+ describe ( '.openVirtualPort' , function ( ) {
155
+ var output = new Midi . output ( ) ;
156
+
157
+ it ( 'requires an argument' , function ( ) {
158
+ ( function ( ) {
159
+ output . openVirtualPort ( ) ;
160
+ } ) . should . throw ( 'First argument must be a string' ) ;
161
+ } ) ;
162
+
163
+ it ( 'requires a string' , function ( ) {
164
+ ( function ( ) {
165
+ output . openVirtualPort ( 999 ) ;
166
+ } ) . should . throw ( 'First argument must be a string' ) ;
167
+ } ) ;
168
+ } ) ;
169
+
170
+ describe ( '.closePort' , function ( ) {
171
+ var output = new Midi . output ( ) ;
172
+
173
+ it ( 'allows you to close a port that was not opened' , function ( ) {
174
+ output . closePort ( ) ;
175
+ } ) ;
176
+ } ) ;
85
177
} ) ;
0 commit comments