提交 693e9be0 编写于 作者: 杜庆泉's avatar 杜庆泉

修改json 测试用例 适配新的语法

上级 a912f940
...@@ -11,7 +11,7 @@ export function testJSON() : Result { ...@@ -11,7 +11,7 @@ export function testJSON() : Result {
return describe("JSON", () => { return describe("JSON", () => {
test('parse', () => { test('parse', () => {
const json = `{"result":true, "count":42}`; const json = `{"result":true, "count":42}`;
const obj = JSON.parse(json)!; const obj = JSON.parse(json) as UTSJSONObject;
expect(obj["count"]).toEqual(42); expect(obj["count"]).toEqual(42);
expect(obj["result"] as boolean).toEqual(true); expect(obj["result"] as boolean).toEqual(true);
...@@ -29,7 +29,7 @@ export function testJSON() : Result { ...@@ -29,7 +29,7 @@ export function testJSON() : Result {
const json2 = '{"string":"Hello","number":42,"boolean":true,"nullValue":null,"array":[1,2,3],"object":{"nestedKey":"nestedValue"}}'; const json2 = '{"string":"Hello","number":42,"boolean":true,"nullValue":null,"array":[1,2,3],"object":{"nestedKey":"nestedValue"}}';
const obj2 = JSON.parse(json2)!; const obj2 = JSON.parse<UTSJSONObject>(json2)!;
expect(obj2).toEqual({ expect(obj2).toEqual({
string: 'Hello', string: 'Hello',
number: 42, number: 42,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册