diff --git a/pages/API/storage/storage.test.js b/pages/API/storage/storage.test.js index e33716194b9e3d30ff6f13722b8d4054c7437903..c6b0d47a6de09cb3fac48cc14bb49a6f2461338a 100644 --- a/pages/API/storage/storage.test.js +++ b/pages/API/storage/storage.test.js @@ -311,4 +311,13 @@ describe('ExtApi-StorageInfoTest', () => { expect(jest_saveUTSJSONObjectAsyncResult).toBe(1) }) + it('saveUTSJSONObjectArray', async () => { + await page.callMethod('jest_saveUTSJSONObjectArray') + await page.waitFor(600) + const { + jest_saveUTSJSONObjectArraySyncResult + } = await page.data() + expect(jest_saveUTSJSONObjectArraySyncResult).toBe(1) + }) + }); diff --git a/pages/API/storage/storage.uvue b/pages/API/storage/storage.uvue index 335e1f2d20cd5fb3a7192085d55dda2ea9cf995a..6aa4cb2d8c60786a2b69606c78c533fa5c1fde01 100644 --- a/pages/API/storage/storage.uvue +++ b/pages/API/storage/storage.uvue @@ -114,7 +114,8 @@ storageInfo: '', staticComplexRet: false, jest_saveUTSJSONObjectSyncResult: 0, - jest_saveUTSJSONObjectAsyncResult: 0 + jest_saveUTSJSONObjectAsyncResult: 0, + jest_saveUTSJSONObjectArraySyncResult: 0 } }, methods: { @@ -391,6 +392,14 @@ console.log('this.jest_saveUTSJSONObjectAsyncResult: ' + this.jest_saveUTSJSONObjectAsyncResult) } }) + }, + jest_saveUTSJSONObjectArray() { + const key = 'test_key_saveUTSJSONObjectArray' + uni.setStorageSync(key, [{ + a: 1 + }] as UTSJSONObject[]) + const dataSync = uni.getStorageSync(key) as UTSJSONObject[] + this.jest_saveUTSJSONObjectArraySyncResult = dataSync[0].get('a') as number } }, }