File tree Expand file tree Collapse file tree 2 files changed +35
-1
lines changed Expand file tree Collapse file tree 2 files changed +35
-1
lines changed Original file line number Diff line number Diff line change 1+ import { EmailJSResponseStatus } from './EmailJSResponseStatus' ;
2+
3+ it ( 'should handle the success response' , ( ) => {
4+ const error = new EmailJSResponseStatus ( {
5+ status : 200 ,
6+ responseText : 'OK' ,
7+ } as XMLHttpRequest ) ;
8+
9+ expect ( error ) . toEqual ( {
10+ status : 200 ,
11+ text : 'OK' ,
12+ } ) ;
13+ } ) ;
14+
15+ it ( 'should handle the fail response' , ( ) => {
16+ const error = new EmailJSResponseStatus ( {
17+ status : 404 ,
18+ responseText : 'No Found' ,
19+ } as XMLHttpRequest ) ;
20+
21+ expect ( error ) . toEqual ( {
22+ status : 404 ,
23+ text : 'No Found' ,
24+ } ) ;
25+ } ) ;
26+
27+ it ( 'should handle the null response' , ( ) => {
28+ const error = new EmailJSResponseStatus ( null ) ;
29+
30+ expect ( error ) . toEqual ( {
31+ status : 0 ,
32+ text : 'Network Error' ,
33+ } ) ;
34+ } ) ;
Original file line number Diff line number Diff line change @@ -4,6 +4,6 @@ export class EmailJSResponseStatus {
44
55 constructor ( httpResponse : XMLHttpRequest | null ) {
66 this . status = httpResponse ?. status || 0 ;
7- this . text = httpResponse ?. responseText || 'network error ' ;
7+ this . text = httpResponse ?. responseText || 'Network Error ' ;
88 }
99}
You can’t perform that action at this time.
0 commit comments