@@ -11,104 +11,104 @@ var originalUtils = utils.fileCommandJson;
11
11
var originalMacVersion = utils . isMountainLion ;
12
12
var originalType = os . type ;
13
13
14
- describe ( 'Mac fallback' , function ( ) {
14
+ describe ( 'Mac fallback' , function ( ) {
15
15
var original = utils . isMountainLion ;
16
16
var originalMac = utils . isMac ;
17
17
18
- afterEach ( function ( ) {
18
+ afterEach ( function ( ) {
19
19
utils . isMountainLion = original ;
20
20
utils . isMac = originalMac ;
21
21
} ) ;
22
22
23
- it ( 'should default to Growl notification if older Mac OSX than 10.8' , function ( done ) {
24
- utils . isMountainLion = function ( ) {
23
+ it ( 'should default to Growl notification if older Mac OSX than 10.8' , function ( done ) {
24
+ utils . isMountainLion = function ( ) {
25
25
return false ;
26
26
} ;
27
- utils . isMac = function ( ) {
27
+ utils . isMac = function ( ) {
28
28
return true ;
29
29
} ;
30
30
var n = new NotificationCenter ( { withFallback : true } ) ;
31
- n . notify ( { message : 'Hello World' } , function ( _ , response ) {
31
+ n . notify ( { message : 'Hello World' } , function ( _ , response ) {
32
32
expect ( this ) . toBeInstanceOf ( Growl ) ;
33
33
done ( ) ;
34
34
} ) ;
35
35
} ) ;
36
36
37
- it ( 'should not fallback to Growl notification if withFallback is false' , function ( done ) {
38
- utils . isMountainLion = function ( ) {
37
+ it ( 'should not fallback to Growl notification if withFallback is false' , function ( done ) {
38
+ utils . isMountainLion = function ( ) {
39
39
return false ;
40
40
} ;
41
- utils . isMac = function ( ) {
41
+ utils . isMac = function ( ) {
42
42
return true ;
43
43
} ;
44
44
var n = new NotificationCenter ( ) ;
45
- n . notify ( { message : 'Hello World' } , function ( err , response ) {
45
+ n . notify ( { message : 'Hello World' } , function ( err , response ) {
46
46
expect ( err ) . toBeTruthy ( ) ;
47
47
expect ( this ) . not . toBeInstanceOf ( Growl ) ;
48
48
done ( ) ;
49
49
} ) ;
50
50
} ) ;
51
51
} ) ;
52
52
53
- describe ( 'terminal-notifier' , function ( ) {
54
- beforeEach ( function ( ) {
55
- os . type = function ( ) {
53
+ describe ( 'terminal-notifier' , function ( ) {
54
+ beforeEach ( function ( ) {
55
+ os . type = function ( ) {
56
56
return 'Darwin' ;
57
57
} ;
58
58
59
- utils . isMountainLion = function ( ) {
59
+ utils . isMountainLion = function ( ) {
60
60
return true ;
61
61
} ;
62
62
} ) ;
63
63
64
- beforeEach ( function ( ) {
64
+ beforeEach ( function ( ) {
65
65
notifier = new NotificationCenter ( ) ;
66
66
} ) ;
67
67
68
- afterEach ( function ( ) {
68
+ afterEach ( function ( ) {
69
69
os . type = originalType ;
70
70
utils . isMountainLion = originalMacVersion ;
71
71
} ) ;
72
72
73
73
// Simulate async operation, move to end of message queue.
74
74
function asyncify ( fn ) {
75
- return function ( ) {
75
+ return function ( ) {
76
76
var args = arguments ;
77
- setTimeout ( function ( ) {
77
+ setTimeout ( function ( ) {
78
78
fn . apply ( null , args ) ;
79
79
} , 0 ) ;
80
80
} ;
81
81
}
82
82
83
- describe ( '#notify()' , function ( ) {
84
- beforeEach ( function ( ) {
85
- utils . fileCommandJson = asyncify ( function ( n , o , cb ) {
83
+ describe ( '#notify()' , function ( ) {
84
+ beforeEach ( function ( ) {
85
+ utils . fileCommandJson = asyncify ( function ( n , o , cb ) {
86
86
cb ( null , '' ) ;
87
87
} ) ;
88
88
} ) ;
89
89
90
- afterEach ( function ( ) {
90
+ afterEach ( function ( ) {
91
91
utils . fileCommandJson = originalUtils ;
92
92
} ) ;
93
93
94
- it ( 'should notify with a message' , function ( done ) {
95
- notifier . notify ( { message : 'Hello World' } , function ( err , response ) {
94
+ it ( 'should notify with a message' , function ( done ) {
95
+ notifier . notify ( { message : 'Hello World' } , function ( err , response ) {
96
96
expect ( err ) . toBeNull ( ) ;
97
97
done ( ) ;
98
98
} ) ;
99
99
} ) ;
100
100
101
- it ( 'should be chainable' , function ( done ) {
101
+ it ( 'should be chainable' , function ( done ) {
102
102
notifier
103
103
. notify ( { message : 'First test' } )
104
- . notify ( { message : 'Second test' } , function ( err , response ) {
104
+ . notify ( { message : 'Second test' } , function ( err , response ) {
105
105
expect ( err ) . toBeNull ( ) ;
106
106
done ( ) ;
107
107
} ) ;
108
108
} ) ;
109
109
110
- it ( 'should be able to list all notifications' , function ( done ) {
111
- utils . fileCommandJson = asyncify ( function ( n , o , cb ) {
110
+ it ( 'should be able to list all notifications' , function ( done ) {
111
+ utils . fileCommandJson = asyncify ( function ( n , o , cb ) {
112
112
cb (
113
113
null ,
114
114
fs
@@ -117,14 +117,14 @@ describe('terminal-notifier', function() {
117
117
) ;
118
118
} ) ;
119
119
120
- notifier . notify ( { list : 'ALL' } , function ( _ , response ) {
120
+ notifier . notify ( { list : 'ALL' } , function ( _ , response ) {
121
121
expect ( response ) . toBeTruthy ( ) ;
122
122
done ( ) ;
123
123
} ) ;
124
124
} ) ;
125
125
126
- it ( 'should be able to remove all messages' , function ( done ) {
127
- utils . fileCommandJson = asyncify ( function ( n , o , cb ) {
126
+ it ( 'should be able to remove all messages' , function ( done ) {
127
+ utils . fileCommandJson = asyncify ( function ( n , o , cb ) {
128
128
cb (
129
129
null ,
130
130
fs
@@ -133,39 +133,39 @@ describe('terminal-notifier', function() {
133
133
) ;
134
134
} ) ;
135
135
136
- notifier . notify ( { remove : 'ALL' } , function ( _ , response ) {
136
+ notifier . notify ( { remove : 'ALL' } , function ( _ , response ) {
137
137
expect ( response ) . toBeTruthy ( ) ;
138
138
139
- utils . fileCommandJson = asyncify ( function ( n , o , cb ) {
139
+ utils . fileCommandJson = asyncify ( function ( n , o , cb ) {
140
140
cb ( null , '' ) ;
141
141
} ) ;
142
142
143
- notifier . notify ( { list : 'ALL' } , function ( _ , response ) {
143
+ notifier . notify ( { list : 'ALL' } , function ( _ , response ) {
144
144
expect ( response ) . toBeFalsy ( ) ;
145
145
done ( ) ;
146
146
} ) ;
147
147
} ) ;
148
148
} ) ;
149
149
} ) ;
150
150
151
- describe ( 'arguments' , function ( ) {
152
- beforeEach ( function ( ) {
151
+ describe ( 'arguments' , function ( ) {
152
+ beforeEach ( function ( ) {
153
153
this . original = utils . fileCommandJson ;
154
154
} ) ;
155
155
156
- afterEach ( function ( ) {
156
+ afterEach ( function ( ) {
157
157
utils . fileCommandJson = this . original ;
158
158
} ) ;
159
159
160
160
function expectArgsListToBe ( expected , done ) {
161
- utils . fileCommandJson = asyncify ( function ( notifier , argsList , callback ) {
161
+ utils . fileCommandJson = asyncify ( function ( notifier , argsList , callback ) {
162
162
expect ( argsList ) . toEqual ( expected ) ;
163
163
callback ( ) ;
164
164
done ( ) ;
165
165
} ) ;
166
166
}
167
167
168
- it ( 'should allow for non-sensical arguments (fail gracefully)' , function ( done ) {
168
+ it ( 'should allow for non-sensical arguments (fail gracefully)' , function ( done ) {
169
169
var expected = [
170
170
'-title' ,
171
171
'"title"' ,
@@ -191,8 +191,8 @@ describe('terminal-notifier', function() {
191
191
} ) ;
192
192
} ) ;
193
193
194
- it ( 'should validate and transform sound to default sound if Windows sound is selected' , function ( done ) {
195
- utils . fileCommandJson = asyncify ( function ( notifier , argsList , callback ) {
194
+ it ( 'should validate and transform sound to default sound if Windows sound is selected' , function ( done ) {
195
+ utils . fileCommandJson = asyncify ( function ( notifier , argsList , callback ) {
196
196
expect ( testUtils . getOptionValue ( argsList , '-title' ) ) . toBe ( '"Heya"' ) ;
197
197
expect ( testUtils . getOptionValue ( argsList , '-sound' ) ) . toBe ( '"Bottle"' ) ;
198
198
callback ( ) ;
@@ -206,14 +206,14 @@ describe('terminal-notifier', function() {
206
206
} ) ;
207
207
} ) ;
208
208
209
- it ( 'should convert list of actions to flat list' , function ( done ) {
209
+ it ( 'should convert list of actions to flat list' , function ( done ) {
210
210
var expected = [
211
211
'-title' ,
212
212
'"title \\"message\\""' ,
213
213
'-message' ,
214
214
'"body \\"message\\""' ,
215
215
'-actions' ,
216
- 'foo, bar, baz "foo" bar' ,
216
+ '" foo"," bar"," baz \\ "foo\\ " bar" ' ,
217
217
'-timeout' ,
218
218
'"10"' ,
219
219
'-json' ,
@@ -232,7 +232,7 @@ describe('terminal-notifier', function() {
232
232
} ) ;
233
233
} ) ;
234
234
235
- it ( 'should still support wait flag with default timeout' , function ( done ) {
235
+ it ( 'should still support wait flag with default timeout' , function ( done ) {
236
236
var expected = [
237
237
'-title' ,
238
238
'"Title"' ,
@@ -252,7 +252,7 @@ describe('terminal-notifier', function() {
252
252
notifier . notify ( { title : 'Title' , message : 'Message' , wait : true } ) ;
253
253
} ) ;
254
254
255
- it ( 'should let timeout set precedence over wait' , function ( done ) {
255
+ it ( 'should let timeout set precedence over wait' , function ( done ) {
256
256
var expected = [
257
257
'-title' ,
258
258
'"Title"' ,
@@ -277,7 +277,7 @@ describe('terminal-notifier', function() {
277
277
} ) ;
278
278
} ) ;
279
279
280
- it ( 'should not set a default timeout if explicitly false' , function ( done ) {
280
+ it ( 'should not set a default timeout if explicitly false' , function ( done ) {
281
281
var expected = [
282
282
'-title' ,
283
283
'"Title"' ,
@@ -299,7 +299,7 @@ describe('terminal-notifier', function() {
299
299
} ) ;
300
300
} ) ;
301
301
302
- it ( 'should escape all title and message' , function ( done ) {
302
+ it ( 'should escape all title and message' , function ( done ) {
303
303
var expected = [
304
304
'-title' ,
305
305
'"title \\"message\\""' ,
0 commit comments