未验证 提交 707d9743 编写于 作者: O openharmony_ci 提交者: Gitee

!5325 hiappeventjs新增用例,hiappventsub修改用例

Merge pull request !5325 from chenxuihui/master
......@@ -538,12 +538,12 @@ describe('HiAppEventApiTest', function () {
console.info('testHiAppEventApi24 end')
})
/**
/**
* @tc.number DFX_DFT_HiviewKit_HiAppEvent_JSNAPI_2500
* @tc.name testHiAppEventApi25
* @tc.desc HiAppEvent with predefined event and param.
*/
it('testHiAppEventApi25', 3, async function (done) {
it('testHiAppEventApi25', 3, async function (done) {
console.info('testHiAppEventApi25 start')
HiAppEvent.write(HiAppEvent.Event.USER_LOGIN, HiAppEvent.EventType.BEHAVIOR,
{[HiAppEvent.Param.USER_ID]: 'userlogin', [HiAppEvent.Param.DISTRIBUTED_SERVICE_NAME]: 'HiAppEvent',
......@@ -578,5 +578,59 @@ describe('HiAppEventApiTest', function () {
});
console.info('testHiAppEventApi25 end')
})
/**
* @tc.number DFX_DFT_HiviewKit_HiAppEvent_JSNAPI_2600
* @tc.name testHiAppEventApi26
* @tc.desc HiAppEvent write by Promise.
*/
it('testHiAppEventApi26', 2, async function (done) {
console.info('testHiAppEventApi26 start')
HiAppEvent.write({
domain: "test_domain",
name: "write",
eventType: HiAppEvent.EventType.FAULT,
params: {
"key_int": 100, "key_string": "demo",
"key_bool":true, "key_float":1.1,"key_array_int": [1, 2, 3], "key_array_float": [1.1, 2.2, 3.3],
"key_array_str": ["a", "b", "c"], "key_array_bool": [true, false],"key_array_int2": [1, 2, 3],
"key_arr_float2": [1.1, 2.2, 3.3], "key_arr_str2": ["a", "b", "c"], "key_array_bool2": [true, false]
}
}).then((value) => {
console.log(`success to write event: ${value}`);
done();
}).catch((err) =>{
console.error(`failed to write event because ${err.code}`);
});
console.info('testHiAppEventApi26 end')
})
/**
* @tc.number DFX_DFT_HiviewKit_HiAppEvent_JSNAPI_2700
* @tc.name testHiAppEventApi27
* @tc.desc HiAppEvent write by callback.
*/
it('testHiAppEventApi27', 2, async function (done) {
console.info('testHiAppEventApi27 start')
HiAppEvent.write({
domain: "test_domain",
name: "test_event",
eventType: HiAppEvent.EventType.FAULT,
params: {
"key_int": 100, "key_string": "demo",
"key_bool":true, "key_float":1.1,"key_array_int": [1, 2, 3], "key_array_float": [1.1, 2.2, 3.3],
"key_array_str": ["a", "b", "c"], "key_array_bool": [true, false],"key_array_int2": [1, 2, 3],
"key_arr_float2": [1.1, 2.2, 3.3], "key_arr_str2": ["a", "b", "c"], "key_array_bool2": [true, false]
}
}, (err, value) => {
if (err) {
console.error(`failed to write event because ${err.code}`);
done();
}
console.log(`success to write event: ${value}`)
done();
});
console.info('testHiAppEventApi27 end')
})
})
}
}
\ No newline at end of file
......@@ -2003,7 +2003,7 @@ describe('HiAppEventSubTest', function () {
* @tc.name 验证清理接口功能
* @tc.desc HiAppEvent write interface test.
*/
it('HiAppEventSub27', 3, async function () {
it('HiAppEventSub27', 3, function () {
console.info('testHiAppEventSub27 start')
HiAppEvent.clearData()
expect(true).assertTrue()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册