@@ -115,6 +115,86 @@ describe("Error handling", function () {
115
115
logStub . lastCall . calledWith ( '' ) . should . be . true ;
116
116
} ) ;
117
117
118
+ it ( "logs errors from an undefined error argument" , function ( ) {
119
+ var message = "Testing" ;
120
+
121
+ errors . logError ( undefined , message , message ) ;
122
+
123
+ // Calls log with message on Error objects
124
+
125
+ logStub . callCount . should . equal ( 4 ) ;
126
+ logStub . firstCall . calledWith ( "\nERROR:" . red , "An unknown error occurred." . red ) . should . be . true ;
127
+ logStub . secondCall . calledWith ( message . white ) . should . be . true ;
128
+ logStub . thirdCall . calledWith ( message . green ) . should . be . true ;
129
+ logStub . lastCall . calledWith ( '' ) . should . be . true ;
130
+ } ) ;
131
+
132
+ it ( "logs errors from an undefined context argument" , function ( ) {
133
+ var message = "Testing" ;
134
+
135
+ errors . logError ( message , undefined , message ) ;
136
+
137
+ // Calls log with message on Error objects
138
+
139
+ logStub . callCount . should . equal ( 3 ) ;
140
+ logStub . firstCall . calledWith ( "\nERROR:" . red , message . red ) . should . be . true ;
141
+ logStub . secondCall . calledWith ( message . green ) . should . be . true ;
142
+ logStub . lastCall . calledWith ( '' ) . should . be . true ;
143
+ } ) ;
144
+
145
+ it ( "logs errors from an undefined help argument" , function ( ) {
146
+ var message = "Testing" ;
147
+
148
+ errors . logError ( message , message , undefined ) ;
149
+
150
+ // Calls log with message on Error objects
151
+
152
+ logStub . callCount . should . equal ( 3 ) ;
153
+ logStub . firstCall . calledWith ( "\nERROR:" . red , message . red ) . should . be . true ;
154
+ logStub . secondCall . calledWith ( message . white ) . should . be . true ;
155
+ logStub . lastCall . calledWith ( '' ) . should . be . true ;
156
+ } ) ;
157
+
158
+ it ( "logs errors from a null error argument" , function ( ) {
159
+ var message = "Testing" ;
160
+
161
+ errors . logError ( null , message , message ) ;
162
+
163
+ // Calls log with message on Error objects
164
+
165
+ logStub . callCount . should . equal ( 4 ) ;
166
+ logStub . firstCall . calledWith ( "\nERROR:" . red , "An unknown error occurred." . red ) . should . be . true ;
167
+ logStub . secondCall . calledWith ( message . white ) . should . be . true ;
168
+ logStub . thirdCall . calledWith ( message . green ) . should . be . true ;
169
+ logStub . lastCall . calledWith ( '' ) . should . be . true ;
170
+ } ) ;
171
+
172
+ it ( "logs errors from a null context argument" , function ( ) {
173
+ var message = "Testing" ;
174
+
175
+ errors . logError ( message , null , message ) ;
176
+
177
+ // Calls log with message on Error objects
178
+
179
+ logStub . callCount . should . equal ( 3 ) ;
180
+ logStub . firstCall . calledWith ( "\nERROR:" . red , message . red ) . should . be . true ;
181
+ logStub . secondCall . calledWith ( message . green ) . should . be . true ;
182
+ logStub . lastCall . calledWith ( '' ) . should . be . true ;
183
+ } ) ;
184
+
185
+ it ( "logs errors from a null help argument" , function ( ) {
186
+ var message = "Testing" ;
187
+
188
+ errors . logError ( message , message , null ) ;
189
+
190
+ // Calls log with message on Error objects
191
+
192
+ logStub . callCount . should . equal ( 3 ) ;
193
+ logStub . firstCall . calledWith ( "\nERROR:" . red , message . red ) . should . be . true ;
194
+ logStub . secondCall . calledWith ( message . white ) . should . be . true ;
195
+ logStub . lastCall . calledWith ( '' ) . should . be . true ;
196
+ } ) ;
197
+
118
198
it ( "logs promise errors and redirects" , function ( done ) {
119
199
var def = when . defer ( ) ,
120
200
prom = def . promise ,
0 commit comments