| Index: sdk/lib/_internal/pub/test/serve/web_socket/returns_errors_on_bad_commands_test.dart
|
| diff --git a/sdk/lib/_internal/pub/test/serve/web_socket/returns_errors_on_bad_commands_test.dart b/sdk/lib/_internal/pub/test/serve/web_socket/returns_errors_on_bad_commands_test.dart
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..94c591039fb841600cbc5ef8ea172aafcc9d9b78
|
| --- /dev/null
|
| +++ b/sdk/lib/_internal/pub/test/serve/web_socket/returns_errors_on_bad_commands_test.dart
|
| @@ -0,0 +1,40 @@
|
| +// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS d.file
|
| +// for details. All rights reserved. Use of this source code is governed by a
|
| +// BSD-style license that can be found in the LICENSE file.
|
| +
|
| +library pub_tests;
|
| +
|
| +import 'package:scheduled_test/scheduled_test.dart';
|
| +import '../../descriptor.dart' as d;
|
| +import '../../test_pub.dart';
|
| +import '../utils.dart';
|
| +
|
| +main() {
|
| + initConfig();
|
| + integration("handles bad commands", () {
|
| + d.dir(appPath, [
|
| + d.appPubspec()
|
| + ]).create();
|
| +
|
| + startPubServe();
|
| +
|
| + webSocketShouldReply(
|
| + "not even valid json",
|
| + equals({"error": '"not even valid json" is not valid JSON.'}),
|
| + encodeRequest: false);
|
| +
|
| + webSocketShouldReply(
|
| + {"command": "wat"},
|
| + equals({"error": 'Unknown command "wat".'}));
|
| +
|
| + webSocketShouldReply(
|
| + ["not", "a", "map"],
|
| + equals({"error": "Command must be a JSON map."}));
|
| +
|
| + webSocketShouldReply(
|
| + {"wat": "there's no command"},
|
| + equals({"error": "Missing command name."}));
|
| +
|
| + endPubServe();
|
| + });
|
| +}
|
|
|