From 86db42bc6b2b101ac30540dbd4afbf7b7d88a1b6 Mon Sep 17 00:00:00 2001 From: duqingquan Date: Tue, 22 Aug 2023 17:49:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9A=82=E6=97=B6=E5=B1=8F=E8=94=BD=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E7=9A=84=E7=A4=BA=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- uni_modules/uts-tests/utssdk/Date.uts | 10 ++++++++-- uni_modules/uts-tests/utssdk/JSON.uts | 10 +++++----- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/uni_modules/uts-tests/utssdk/Date.uts b/uni_modules/uts-tests/utssdk/Date.uts index 8197cf7..b5daea0 100644 --- a/uni_modules/uts-tests/utssdk/Date.uts +++ b/uni_modules/uts-tests/utssdk/Date.uts @@ -27,8 +27,14 @@ export function testDate() : Result { const date1 = new Date('01 Jan 1970 00:00:00 GMT'); const date2 = new Date('December 17, 1995 03:24:00'); - expect(date1.toTimeString()).toEqual("08:00:00 GMT+0800 (中国标准时间)"); - expect(date2.toTimeString()).toEqual("03:24:00 GMT+0800 (中国标准时间)"); + // // #ifndef APP-IOS + // expect(date1.toTimeString()).toEqual("08:00:00 GMT+0800 (中国标准时间)"); + // expect(date2.toTimeString()).toEqual("03:24:00 GMT+0800 (中国标准时间)"); + // // #endif + // // #ifndef APP-ANDROID + // expect(date1.toTimeString()).toEqual("08:00:00 GMT+0800"); + // expect(date2.toTimeString()).toEqual("03:24:00 GMT+0800"); + // // #endif }) test('getDate', () => { diff --git a/uni_modules/uts-tests/utssdk/JSON.uts b/uni_modules/uts-tests/utssdk/JSON.uts index 73805f0..274fd4e 100644 --- a/uni_modules/uts-tests/utssdk/JSON.uts +++ b/uni_modules/uts-tests/utssdk/JSON.uts @@ -114,18 +114,16 @@ export function testJSON() : Result { const json3 = `[{"name":"John","id":"30"},{"name":"jack","id":"21"}]`; const array3 = JSON.parseArray(json3); - expect((array3!![0] as UserJSON).name).toEqual("John"); + expect((array3![0] as UTSJSONObject)["name"]).toEqual("John"); }) test('stringify', () => { const obj = { name: 'John', age: 30 }; const json = JSON.stringify(obj); // expect(json).toEqual('{"name":"John","age":30}'); - console.log(json) const obj1 = { name: 'John', age: 30, address: { city: 'New York', country: 'USA' } }; const json1 = JSON.stringify(obj1); - console.log(json1) // expect(json1).toEqual('{"address":{"country":"USA","city":"New York"},"name":"John","age":30}'); const obj2 = ['apple', 'banana', 'cherry']; @@ -145,7 +143,6 @@ export function testJSON() : Result { // "age": 30 // }`); // expect(JSON.stringify({ x: 5, y: 6 })).toEqual(`{"x":5,"y":6}`); - console.log(JSON.stringify({ x: 5, y: 6 })) expect(JSON.stringify([3, 'false', false])).toEqual(`[3,"false",false]`); expect(JSON.stringify({})).toEqual('{}'); expect(JSON.stringify(1002)).toEqual('1002'); @@ -154,9 +151,12 @@ export function testJSON() : Result { // expect(JSON.stringify(100/0.0)).toEqual('null'); expect(JSON.stringify(true)).toEqual('true'); expect(JSON.stringify(false)).toEqual('false'); - expect(JSON.stringify('foo')).toEqual('foo'); + //console.log(JSON.stringify('foo')) + //expect(JSON.stringify('foo')).toEqual('foo'); expect(JSON.stringify(Math.PI)).toEqual('3.141592653589793'); expect(JSON.stringify(Math.E)).toEqual('2.718281828459045'); + + }) -- GitLab