@@ -14,6 +14,7 @@ describe('validate', function () {
14
14
expect ( result . result ) . to . equal ( false ) ;
15
15
expect ( result . reason ) . to . equal ( 'Unable to parse: Could not identify the URL.' +
16
16
' Please use the --url option.' ) ;
17
+ expect ( result . error ) . to . have . property ( 'message' , result . reason ) ;
17
18
done ( ) ;
18
19
} ) ;
19
20
} ) ;
@@ -41,6 +42,7 @@ describe('getMetaData', function () {
41
42
expect ( result . result ) . to . equal ( false ) ;
42
43
expect ( result . reason ) . to . equal ( 'Unable to parse: Could not identify the URL.' +
43
44
' Please use the --url option.' ) ;
45
+ expect ( result . error ) . to . have . property ( 'message' , result . reason ) ;
44
46
done ( ) ;
45
47
} ) ;
46
48
} ) ;
@@ -53,6 +55,7 @@ describe('getMetaData', function () {
53
55
expect ( result . result ) . to . equal ( false ) ;
54
56
expect ( result . reason ) . to . equal ( 'Unable to parse: Could not identify the URL.' +
55
57
' Please use the --url option.' ) ;
58
+ expect ( result . error ) . to . have . property ( 'message' , result . reason ) ;
56
59
done ( ) ;
57
60
} ) ;
58
61
} ) ;
@@ -68,6 +71,7 @@ describe('Curl converter should', function() {
68
71
expect ( result . result ) . to . equal ( false ) ;
69
72
expect ( result . reason ) . to . equal ( 'Unable to parse: Could not identify the URL.' +
70
73
' Please use the --url option.' ) ;
74
+ expect ( result . error ) . to . have . property ( 'message' , result . reason ) ;
71
75
done ( ) ;
72
76
} ) ;
73
77
} ) ;
@@ -80,10 +84,22 @@ describe('Curl converter should', function() {
80
84
expect ( result . result ) . to . equal ( false ) ;
81
85
expect ( result . reason ) . to . equal ( 'Unable to parse: Could not identify the URL.' +
82
86
' Please use the --url option.' ) ;
87
+ expect ( result . error ) . to . have . property ( 'message' , result . reason ) ;
83
88
done ( ) ;
84
89
} ) ;
85
90
} ) ;
86
91
92
+ it ( 'throw an error when an invalid method is specificied' , function ( done ) {
93
+ convert ( {
94
+ type : 'string' ,
95
+ data : 'curl --request INVALIDMETHOD --url http://www.google.com'
96
+ } , function ( err , result ) {
97
+ expect ( result . result ) . to . equal ( false ) ;
98
+ expect ( result . reason ) . to . equal ( 'The method INVALIDMETHOD is not supported.' ) ;
99
+ expect ( result . error ) . to . have . property ( 'message' , result . reason ) ;
100
+ done ( ) ;
101
+ } ) ;
102
+ } ) ;
87
103
88
104
it ( 'throw an error for a cURL without URL defined correctly' , function ( done ) {
89
105
convert ( {
@@ -93,6 +109,7 @@ describe('Curl converter should', function() {
93
109
expect ( result . result ) . to . equal ( false ) ;
94
110
expect ( result . reason ) . to . equal ( 'Unable to parse: Could not identify the URL.' +
95
111
' Please use the --url option.' ) ;
112
+ expect ( result . error ) . to . have . property ( 'message' , result . reason ) ;
96
113
done ( ) ;
97
114
} ) ;
98
115
} ) ;
@@ -247,7 +264,8 @@ describe('Curl converter should', function() {
247
264
} , function ( err , result ) {
248
265
expect ( result . result ) . to . equal ( false ) ;
249
266
expect ( result . reason ) . to . equal ( 'Unable to parse: Both (--head/-I) and' +
250
- ' (-d/--data/--data-raw/--data-binary/--data-ascii/--data-urlencode) are not supported' ) ;
267
+ ' (-d/--data/--data-raw/--data-binary/--data-ascii/--data-urlencode) are not supported.' ) ;
268
+ expect ( result . error ) . to . have . property ( 'message' , result . reason ) ;
251
269
done ( ) ;
252
270
} ) ;
253
271
} ) ;
@@ -937,7 +955,8 @@ describe('Curl converter should', function() {
937
955
test?bar=1&baz=2`
938
956
} , function ( err , result ) {
939
957
expect ( result . result ) . to . equal ( false ) ;
940
- expect ( result . reason ) . to . equal ( 'Please check your cURL string for malformed URL' ) ;
958
+ expect ( result . reason ) . to . equal ( 'Please check your cURL string for malformed URL.' ) ;
959
+ expect ( result . error ) . to . have . property ( 'message' , result . reason ) ;
941
960
done ( ) ;
942
961
} ) ;
943
962
} ) ;
@@ -951,7 +970,8 @@ describe('Curl converter should', function() {
951
970
bar=1&baz=2`
952
971
} , function ( err , result ) {
953
972
expect ( result . result ) . to . equal ( false ) ;
954
- expect ( result . reason ) . to . equal ( 'Please check your cURL string for malformed URL' ) ;
973
+ expect ( result . reason ) . to . equal ( 'Please check your cURL string for malformed URL.' ) ;
974
+ expect ( result . error ) . to . have . property ( 'message' , result . reason ) ;
955
975
done ( ) ;
956
976
} ) ;
957
977
} ) ;
@@ -966,7 +986,8 @@ describe('Curl converter should', function() {
966
986
"test.com/?bar=1&baz=2`
967
987
} , function ( err , result ) {
968
988
expect ( result . result ) . to . equal ( false ) ;
969
- expect ( result . reason ) . to . equal ( 'Please check your cURL string for malformed URL' ) ;
989
+ expect ( result . reason ) . to . equal ( 'Please check your cURL string for malformed URL.' ) ;
990
+ expect ( result . error ) . to . have . property ( 'message' , result . reason ) ;
970
991
done ( ) ;
971
992
} ) ;
972
993
} ) ;
0 commit comments