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

fix: 修复保存UTSJSONObject到storage内的测试例在安卓端测试失败的Bug

上级 b7dd27a1
......@@ -306,8 +306,8 @@ describe('ExtApi-StorageInfoTest', () => {
jest_saveUTSJSONObjectSyncResult,
jest_saveUTSJSONObjectAsyncResult
} = await page.data()
expect(jest_saveUTSJSONObjectSyncResult).toBe(true)
expect(jest_saveUTSJSONObjectAsyncResult).toBe(true)
expect(jest_saveUTSJSONObjectSyncResult).toBe(1)
expect(jest_saveUTSJSONObjectAsyncResult).toBe(1)
})
});
......@@ -113,8 +113,8 @@
apiGetData: '' as any | null,
storageInfo: '',
staticComplexRet: false,
jest_saveUTSJSONObjectSyncResult: false,
jest_saveUTSJSONObjectAsyncResult: false
jest_saveUTSJSONObjectSyncResult: 0,
jest_saveUTSJSONObjectAsyncResult: 0
}
},
methods: {
......@@ -378,13 +378,15 @@
b: 1
}
})
const dataSync = uni.getStorageSync(key)
this.jest_saveUTSJSONObjectSyncResult = dataSync instanceof UTSJSONObject && dataSync['a'] instanceof UTSJSONObject
const dataSync = uni.getStorageSync(key) as UTSJSONObject
const dataSyncA = dataSync['a'] as UTSJSONObject
this.jest_saveUTSJSONObjectSyncResult = dataSyncA.get('b') as number
uni.getStorage({
key,
success: (res) => {
const data = res.data
this.jest_saveUTSJSONObjectAsyncResult = data instanceof UTSJSONObject && data['a'] instanceof UTSJSONObject
const dataAsync = res.data as UTSJSONObject
const dataAsyncA = dataAsync['a'] as UTSJSONObject
this.jest_saveUTSJSONObjectAsyncResult = dataAsyncA.get('b') as number
console.log('this.jest_saveUTSJSONObjectSyncResult: ' + this.jest_saveUTSJSONObjectSyncResult)
console.log('this.jest_saveUTSJSONObjectAsyncResult: ' + this.jest_saveUTSJSONObjectAsyncResult)
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册