File tree Expand file tree Collapse file tree 2 files changed +38
-1
lines changed Expand file tree Collapse file tree 2 files changed +38
-1
lines changed Original file line number Diff line number Diff line change 63
63
"lib" : " lib" ,
64
64
"test" : " test"
65
65
}
66
- }
66
+ }
67
67
Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+
3
+ /**
4
+ * Module dependencies.
5
+ */
6
+
7
+ const { describe, it } = require ( 'mocha' ) ;
8
+ const should = require ( 'chai' ) . should ( ) ;
9
+ const OAuthError = require ( '../../../lib/errors/oauth-error' ) ;
10
+
11
+ /**
12
+ * Test `OAuthError`.
13
+ */
14
+
15
+ describe ( 'OAuthError' , function ( ) {
16
+ describe ( 'constructor()' , function ( ) {
17
+ it ( 'should get `captureStackTrace`' , function ( ) {
18
+
19
+ const errorFn = function ( ) { throw new OAuthError ( 'test' , { name : 'test_error' } ) ; } ;
20
+
21
+ try {
22
+ errorFn ( ) ;
23
+
24
+ should . fail ( ) ;
25
+ } catch ( e ) {
26
+
27
+ e . should . be . an . instanceOf ( OAuthError ) ;
28
+ e . message . should . equal ( 'test' ) ;
29
+ e . code . should . equal ( 500 ) ;
30
+ e . stack . should . not . be . null ;
31
+ e . stack . should . not . be . undefined ;
32
+ e . stack . should . include ( 'oauth-error_test.js' ) ;
33
+ e . stack . should . include ( '19' ) ; //error lineNUmber
34
+ }
35
+ } ) ;
36
+ } ) ;
37
+ } ) ;
You can’t perform that action at this time.
0 commit comments