From 33a52411a364275c931a07bbcfcff5daa67c8549 Mon Sep 17 00:00:00 2001 From: duqingquan Date: Wed, 20 Sep 2023 20:58:14 +0800 Subject: [PATCH] json stringify add --- uni_modules/uts-tests/utssdk/JSON.uts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/uni_modules/uts-tests/utssdk/JSON.uts b/uni_modules/uts-tests/utssdk/JSON.uts index bcf4384..031669d 100644 --- a/uni_modules/uts-tests/utssdk/JSON.uts +++ b/uni_modules/uts-tests/utssdk/JSON.uts @@ -239,6 +239,22 @@ export function testJSON() : Result { expect(JSON.stringify(params)).toEqual('{"args":[{"url":"/pages/index/index"}],"method":"reLaunch"}') + class Stage { + $m: string + $p: Array + constructor(){ + this.$m = 'test' + this.$p = ['type'] + } + } + + const obj22 = { + data: [new Stage()] as Array + } as UTSJSONObject + + expect(JSON.stringify(obj22)).toEqual('{"data":[{"$m":"test","$p":["type"]}]}') + + }) test('invalidField', () => { -- GitLab