File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,10 @@ export default class ParseError {
19
19
this . code = code ;
20
20
this . message = message ;
21
21
}
22
+
23
+ toString ( ) {
24
+ return 'ParseError: ' + this . code + ' ' + this . message ;
25
+ }
22
26
}
23
27
24
28
/**
Original file line number Diff line number Diff line change
1
+ /**
2
+ * Copyright (c) 2015-present, Parse, LLC.
3
+ * All rights reserved.
4
+ *
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree. An additional grant
7
+ * of patent rights can be found in the PATENTS file in the same directory.
8
+ */
9
+
10
+ jest . dontMock ( '../ParseError' ) ;
11
+
12
+ var ParseError = require ( '../ParseError' ) . default ;
13
+
14
+ describe ( 'ParseError' , ( ) => {
15
+ it ( 'have sensible string representation' , ( ) => {
16
+ var error = new ParseError ( 123 , 'some error message' ) ;
17
+
18
+ expect ( error . toString ( ) ) . toMatch ( 'ParseError' ) ;
19
+ expect ( error . toString ( ) ) . toMatch ( '123' ) ;
20
+ expect ( error . toString ( ) ) . toMatch ( 'some error message' ) ;
21
+ } ) ;
22
+ } ) ;
You can’t perform that action at this time.
0 commit comments