提交 4a04f3f6 编写于 作者: 杜庆泉's avatar 杜庆泉

storage 增加储存整型字符串测试示例

上级 bef3eafe
......@@ -241,6 +241,42 @@ describe('ExtApi-StorageInfoTest', () => {
expect(parseObj['name']).toEqual('james')
await page.setData({
key: "autotest_key_mock",
data:"1234567890"
})
await page.waitFor(600)
btnSetStorageButtonInfo = await page.$('.btn-setstorageSync')
await btnSetStorageButtonInfo.tap()
await page.waitFor(600)
btnGetStorageButtonInfo = await page.$('.btn-getstorageSync')
await btnGetStorageButtonInfo.tap()
await page.waitFor(600)
let strRet = await getData('apiGetData')
// 顺序不能保证,验证长度和各个属性来区分
expect(typeof strRet).toEqual("string")
expect(strRet).toEqual("1234567890")
await page.setData({
key: "autotest_key_mock",
data:"1234567.890"
})
await page.waitFor(600)
btnSetStorageButtonInfo = await page.$('.btn-setstorageSync')
await btnSetStorageButtonInfo.tap()
await page.waitFor(600)
btnGetStorageButtonInfo = await page.$('.btn-getstorageSync')
await btnGetStorageButtonInfo.tap()
await page.waitFor(600)
let strRet2 = await getData('apiGetData')
// 顺序不能保证,验证长度和各个属性来区分
expect(typeof strRet2).toEqual("string")
expect(strRet2).toEqual("1234567.890")
});
});
......@@ -49,11 +49,21 @@
<button type="default" style="width:50%" @tap="floatMock">
填充浮点型
</button>
</view>
<view class="uni-flex uni-row">
<button type="default" style="width:100%" @tap="jsonLikeMock">
填充符合json格式的字符串
<button type="default" style="width:50%" @tap="jsonLikeMock">
填充json字符串
</button>
<button type="default" style="width:50%" @tap="longLikeMock">
填充整数字符串
</button>
</view>
<view class="uni-flex uni-row">
<button type="default" style="width:50%" @tap="floatLikeMock">
填充浮点字符串
</button>
<button type="default" style="width:50%" @tap="negativeLikeMock">
填充负数字符串
</button>
</view>
</view>
......@@ -124,6 +134,19 @@
age: 12,
from: "american"
});
},
longLikeMock() {
this.key = 'key_' + Math.random()
this.data = "1234567890"
},
floatLikeMock() {
this.key = 'key_' + Math.random()
this.data = "321456.1234567890"
},
negativeLikeMock() {
this.key = 'key_' + Math.random()
this.data = "-321456"
},
strMock() {
this.key = 'key_' + Math.random()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册