Make the json_rpc_2 server test dart2js-compatible.
R=rnystrom@google.com
TBR
Review URL: https://codereview.chromium.org//207323004
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart/pkg/json_rpc_2@34226 260f80e4-7a28-3924-810f-c04153c831b5
diff --git a/test/server/server_test.dart b/test/server/server_test.dart
index f1e0af5..fc3adb5 100644
--- a/test/server/server_test.dart
+++ b/test/server/server_test.dart
@@ -76,7 +76,7 @@
'data': {
'request': {'jsonrpc': '2.0', 'method': 'foo', 'id': 1234},
'full': 'FormatException: bad format',
- 'stack': contains('server_test.dart')
+ 'stack': new isInstanceOf<String>()
}
}
}));
@@ -123,17 +123,17 @@
});
test("a JSON parse error is rejected", () {
- expect(server.parseRequest('invalid json {'),
- completion(equals(JSON.encode({
- 'jsonrpc': '2.0',
- 'error': {
- 'code': error_code.PARSE_ERROR,
- 'message': "Invalid JSON: Unexpected character at 0: 'invalid json "
- "{'",
- 'data': {'request': 'invalid json {'}
- },
- 'id': null
- }))));
+ return server.parseRequest('invalid json {').then((result) {
+ expect(JSON.decode(result), {
+ 'jsonrpc': '2.0',
+ 'error': {
+ 'code': error_code.PARSE_ERROR,
+ 'message': startsWith("Invalid JSON: "),
+ 'data': {'request': 'invalid json {'}
+ },
+ 'id': null
+ });
+ });
});
});
@@ -189,7 +189,7 @@
'data': {
'request': {'jsonrpc': '2.0', 'method': 'foo', 'id': 1234},
'full': 'FormatException: bad format',
- 'stack': contains('server_test.dart')
+ 'stack': new isInstanceOf<String>()
}
}
}));