提交 10d50717 编写于 作者: 雪洛's avatar 雪洛

test: 增加getStorage获取UTSJSONObject数组的测试

上级 34a670da
......@@ -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)
})
});
......@@ -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
}
},
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册