Chromium Code Reviews| Index: sdk/lib/_internal/pub/test/serve/web_socket/path_to_urls_errors_test.dart |
| diff --git a/sdk/lib/_internal/pub/test/serve/web_socket/path_to_urls_errors_test.dart b/sdk/lib/_internal/pub/test/serve/web_socket/path_to_urls_errors_test.dart |
| index ac77a1cc443901029bcc155e2355e3605445b74c..80aed413b4f1f7f696cafbced543b2d9bbecfb8a 100644 |
| --- a/sdk/lib/_internal/pub/test/serve/web_socket/path_to_urls_errors_test.dart |
| +++ b/sdk/lib/_internal/pub/test/serve/web_socket/path_to_urls_errors_test.dart |
| @@ -4,6 +4,7 @@ |
| library pub_tests; |
| +import 'package:json_rpc_2/error_code.dart' as rpc_error_code; |
| import 'package:path/path.dart' as p; |
| import '../../descriptor.dart' as d; |
| @@ -38,29 +39,15 @@ main() { |
| pubServe(shouldGetFirst: true); |
| // Bad arguments. |
| - expectWebSocketCall({ |
| - "command": "pathToUrls" |
| - }, replyEquals: { |
| - "code": "BAD_ARGUMENT", |
| - "error": 'Missing "path" argument.' |
| - }); |
| + expectWebSocketCall("pathToUrls", {"path": 123}, |
| + errorCode: rpc_error_code.INVALID_PARAMS, |
| + errorMessage: 'Parameter "path" for method "pathToUrls" must be a ' |
| + 'string, but was 123.'); |
| - expectWebSocketCall({ |
| - "command": "pathToUrls", |
| - "path": 123 |
| - }, replyEquals: { |
| - "code": "BAD_ARGUMENT", |
| - "error": '"path" must be a string. Got 123.' |
| - }); |
| - |
| - expectWebSocketCall({ |
| - "command": "pathToUrls", |
| - "path": "main.dart", |
| - "line": 12.34 |
| - }, replyEquals: { |
| - "code": "BAD_ARGUMENT", |
| - "error": '"line" must be an integer. Got 12.34.' |
| - }); |
| + expectWebSocketCall("pathToUrls", {"path": "main.dart", "line": 12.34}, |
| + errorCode: rpc_error_code.INVALID_PARAMS, |
| + errorMessage: 'Parameter "line" for method "pathToUrls" must be an ' |
| + 'integer, but was 12.34.'); |
| // Unserved directories. |
| expectNotServed(p.join('bin', 'foo.txt')); |
| @@ -73,11 +60,7 @@ main() { |
| } |
| void expectNotServed(String path) { |
| - expectWebSocketCall({ |
| - "command": "pathToUrls", |
| - "path": path |
| - }, replyEquals: { |
| - "code": "NOT_SERVED", |
| - "error": 'Asset path "$path" is not currently being served.' |
| - }); |
| + expectWebSocketCall("pathToUrls", {"path": path}, |
| + errorCode: 1, |
|
Bob Nystrom
2014/03/21 17:42:25
Make a constant for this (or publicize the one in
nweiz
2014/03/21 20:27:38
Done.
|
| + errorMessage: 'Asset path "$path" is not currently being served.'); |
| } |