提交 d29f0374 编写于 作者: B bayanxing

ActsGetWantAllTest、ExampleJsunit checkstyle问题整改

Signed-off-by: Nbayanxing <bayanxing@kaihongdigi.com>
上级 cc070174
......@@ -146,6 +146,18 @@ describe('ActsGetWantTest', function () {
},
},
}).then((data) => {
checkOnAbilityResult0300(data);
setTimeout(()=>{
done();
}, TIMEOUT_NUMBER);
}).catch((error) => {
console.log('ACTS_GetWant_0300 error: ' + JSON.stringify(error))
expect.assertFail()
done();
})
})
function checkOnAbilityResult0300(data) {
console.info('====> ACTS_GetWant_0300 start ability=====>' + JSON.stringify(data))
expect(data.want.deviceId).assertEqual("");
expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap");
......@@ -169,15 +181,7 @@ describe('ActsGetWantTest', function () {
expect(data.want.parameters.mykey5[1]).assertEqual("!@#$%");
expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmony");
console.info('====> ACTS_GetWant_0300 before done=====>')
setTimeout(()=>{
done();
}, TIMEOUT_NUMBER);
}).catch((error) => {
console.log('ACTS_GetWant_0300 error: ' + JSON.stringify(error))
expect.assertFail()
done();
})
})
}
// @tc.number: ACTS_GetWant_0400
// @tc.name: getWant : get want in current ability
......@@ -207,6 +211,14 @@ describe('ActsGetWantTest', function () {
},
},
(err, data) => {
checkOnAbilityResult0400(data);
setTimeout(()=>{
done();
}, TIMEOUT_NUMBER);
})
})
function checkOnAbilityResult0400(data) {
console.info('====> ACTS_GetWant_0400 start ability=====>' + JSON.stringify(data))
expect(data.want.deviceId).assertEqual("");
expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap");
......@@ -230,11 +242,7 @@ describe('ActsGetWantTest', function () {
expect(data.want.parameters.mykey5[1]).assertEqual("!@#$%");
expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmony");
console.info('====> ACTS_GetWant_0400 before done=====>')
setTimeout(()=>{
done();
}, TIMEOUT_NUMBER);
})
})
}
// @tc.number: ACTS_GetWant_0500
// @tc.name: getWant : get want in current ability
......@@ -438,6 +446,14 @@ describe('ActsGetWantTest', function () {
},
},
(err, data) => {
checkOnAbilityResult0800(data);
setTimeout(()=>{
done();
}, TIMEOUT_NUMBER);
})
})
function checkOnAbilityResult0800(data) {
console.info('====> ACTS_GetWant_0800 start ability=====>' + JSON.stringify(data))
expect(data.want.deviceId).assertEqual("");
expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap");
......@@ -460,11 +476,7 @@ describe('ActsGetWantTest', function () {
expect(data.want.parameters.mykey5[1]).assertEqual("STR");
expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony");
console.info('====> ACTS_GetWant_0800 before done=====>')
setTimeout(()=>{
done();
}, TIMEOUT_NUMBER);
})
})
}
// @tc.number: ACTS_GetWant_0900
// @tc.name: getWant : get want in current ability
......@@ -553,6 +565,14 @@ describe('ActsGetWantTest', function () {
},
},
(err, data) => {
checkOnAbilityResult1000(data);
setTimeout(()=>{
done();
}, TIMEOUT_NUMBER);
})
})
function checkOnAbilityResult1000(data) {
console.info('====> ACTS_GetWant_1000 start ability=====>' + JSON.stringify(data))
expect(data.want.deviceId).assertEqual("");
expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap");
......@@ -575,11 +595,7 @@ describe('ActsGetWantTest', function () {
expect(data.want.parameters.mykey5[1]).assertEqual("STR");
expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony");
console.info('====> ACTS_GetWant_1000 before done=====>')
setTimeout(()=>{
done();
}, TIMEOUT_NUMBER);
})
})
}
// @tc.number: ACTS_GetWant_1100
// @tc.name: getWant : get want in current ability
......@@ -607,6 +623,18 @@ describe('ActsGetWantTest', function () {
},
},
}).then((data) => {
checkOnAbilityResult1100(data);
setTimeout(()=>{
done();
}, TIMEOUT_NUMBER);
}).catch((error) => {
console.log('ACTS_GetWant_1100 error: ' + JSON.stringify(error))
expect.assertFail()
done();
})
})
function checkOnAbilityResult1100(data) {
console.info('====> ACTS_GetWant_1100 start ability=====>' + JSON.stringify(data))
expect(data.want.deviceId).assertEqual("");
expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap");
......@@ -628,15 +656,7 @@ describe('ActsGetWantTest', function () {
expect(data.want.parameters.mykey5[1]).assertEqual("STR");
expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony");
console.info('====> ACTS_GetWant_1100 before done=====>')
setTimeout(()=>{
done();
}, TIMEOUT_NUMBER);
}).catch((error) => {
console.log('ACTS_GetWant_1100 error: ' + JSON.stringify(error))
expect.assertFail()
done();
})
})
}
// @tc.number: ACTS_GetWant_1200
// @tc.name: getWant : get want in current ability
......@@ -779,6 +799,14 @@ describe('ActsGetWantTest', function () {
},
},
(err, data) => {
checkOnAbilityResult1400(data);
setTimeout(()=>{
done();
}, TIMEOUT_NUMBER);
})
})
function checkOnAbilityResult1400(data) {
console.info('====> ACTS_GetWant_1400 start ability=====>' + JSON.stringify(data))
expect(data.want.deviceId).assertEqual("");
expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap");
......@@ -801,11 +829,7 @@ describe('ActsGetWantTest', function () {
expect(data.want.parameters.mykey5[1]).assertEqual("STR");
expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony");
console.info('====> ACTS_GetWant_1400 before done=====>')
setTimeout(()=>{
done();
}, TIMEOUT_NUMBER);
})
})
}
// @tc.number: ACTS_GetWant_1500
// @tc.name: getWant : get want in current ability
......@@ -834,6 +858,18 @@ describe('ActsGetWantTest', function () {
},
},
}).then((data) => {
checkOnAbilityResult1500(data);
setTimeout(()=>{
done();
}, TIMEOUT_NUMBER);
}).catch((error) => {
console.log('ACTS_GetWant_1500 error: ' + JSON.stringify(error))
expect.assertFail()
done();
})
})
function checkOnAbilityResult1500(data) {
console.info('====> ACTS_GetWant_1500 start ability=====>' + JSON.stringify(data))
expect(data.want.deviceId).assertEqual("");
expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap");
......@@ -856,15 +892,7 @@ describe('ActsGetWantTest', function () {
expect(data.want.parameters.mykey5[1]).assertEqual("STR");
expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony");
console.info('====> ACTS_GetWant_1500 setTimeout before done.=====>')
setTimeout(()=>{
done();
}, TIMEOUT_NUMBER);
}).catch((error) => {
console.log('ACTS_GetWant_1500 error: ' + JSON.stringify(error))
expect.assertFail()
done();
})
})
}
// @tc.number: ACTS_GetWant_1600
// @tc.name: getWant : get want in current ability
......@@ -1064,6 +1092,18 @@ describe('ActsGetWantTest', function () {
},
},
}).then((data) => {
checkOnAbilityResult1900(data);
setTimeout(()=>{
done();
}, TIMEOUT_NUMBER);
}).catch((error) => {
console.log('ACTS_GetWant_1900 error: ' + JSON.stringify(error))
expect.assertFail()
done();
})
})
function checkOnAbilityResult1900(data) {
console.info('====> ACTS_GetWant_1900 start ability=====>' + JSON.stringify(data))
expect(data.want.deviceId).assertEqual("");
expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap");
......@@ -1086,15 +1126,7 @@ describe('ActsGetWantTest', function () {
expect(data.want.parameters.mykey5[1]).assertEqual("STR");
expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony");
console.info('====> ACTS_GetWant_1900 setTimeout before done.=====>')
setTimeout(()=>{
done();
}, TIMEOUT_NUMBER);
}).catch((error) => {
console.log('ACTS_GetWant_1900 error: ' + JSON.stringify(error))
expect.assertFail()
done();
})
})
}
// @tc.number: ACTS_GetWant_2000
// @tc.name: getWant : get want in current ability
......@@ -1124,6 +1156,14 @@ describe('ActsGetWantTest', function () {
},
},
(err, data) => {
checkOnAbilityResult2000(data);
setTimeout(()=>{
done();
}, TIMEOUT_NUMBER);
})
})
function checkOnAbilityResult2000(data) {
console.info('====> ACTS_GetWant_2000 start ability=====>' + JSON.stringify(data))
expect(data.want.deviceId).assertEqual("");
expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap");
......@@ -1146,11 +1186,7 @@ describe('ActsGetWantTest', function () {
expect(data.want.parameters.mykey5[1]).assertEqual("STR");
expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony");
console.info('====> ACTS_GetWant_2000 setTimeout before done.=====>')
setTimeout(()=>{
done();
}, TIMEOUT_NUMBER);
})
})
}
// @tc.number: ACTS_GetWant_2100
// @tc.name: getWant : get want in current ability
......@@ -1179,6 +1215,18 @@ describe('ActsGetWantTest', function () {
},
},
}).then((data) => {
checkOnAbilityResult2100(data);
setTimeout(()=>{
done();
}, TIMEOUT_NUMBER);
}).catch((error) => {
console.log('ACTS_GetWant_2100 error: ' + JSON.stringify(error))
expect.assertFail()
done();
})
})
function checkOnAbilityResult2100(data) {
console.info('====> ACTS_GetWant_2100 start ability=====>' + JSON.stringify(data))
expect(data.want.deviceId).assertEqual("");
expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap");
......@@ -1201,15 +1249,7 @@ describe('ActsGetWantTest', function () {
expect(data.want.parameters.mykey5[1]).assertEqual("STR");
expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony");
console.info('====> ACTS_GetWant_2100 setTimeout before done.=====>')
setTimeout(()=>{
done();
}, TIMEOUT_NUMBER);
}).catch((error) => {
console.log('ACTS_GetWant_2100 error: ' + JSON.stringify(error))
expect.assertFail()
done();
})
})
}
// @tc.number: ACTS_GetWant_2200
// @tc.name: getWant : get want in current ability
......@@ -1239,6 +1279,14 @@ describe('ActsGetWantTest', function () {
},
},
(err, data) => {
checkOnAbilityResult2200(data);
setTimeout(()=>{
done();
}, TIMEOUT_NUMBER);
})
})
function checkOnAbilityResult2200(data) {
console.info('====> ACTS_GetWant_2200 start ability=====>' + JSON.stringify(data))
expect(data.want.deviceId).assertEqual("");
expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap");
......@@ -1261,11 +1309,7 @@ describe('ActsGetWantTest', function () {
expect(data.want.parameters.mykey5[1]).assertEqual("STR");
expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony");
console.info('====> ACTS_GetWant_2200 setTimeout before done.=====>')
setTimeout(()=>{
done();
}, TIMEOUT_NUMBER);
})
})
}
// @tc.number: ACTS_GetWant_2300
// @tc.name: getWant : get want in current ability
......@@ -1294,6 +1338,18 @@ describe('ActsGetWantTest', function () {
},
},
}).then((data) => {
checkOnAbilityResult2300(data);
setTimeout(()=>{
done();
}, TIMEOUT_NUMBER);
}).catch((error) => {
console.log('ACTS_GetWant_2300 error: ' + JSON.stringify(error))
expect.assertFail()
done();
})
})
function checkOnAbilityResult2300(data) {
console.info('====> ACTS_GetWant_2300 start ability=====>' + JSON.stringify(data))
expect(data.want.deviceId).assertEqual("");
expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap");
......@@ -1316,15 +1372,7 @@ describe('ActsGetWantTest', function () {
expect(data.want.parameters.mykey5[1]).assertEqual("STR");
expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony");
console.info('====> ACTS_GetWant_2300 setTimeout before done.=====>')
setTimeout(()=>{
done();
}, TIMEOUT_NUMBER);
}).catch((error) => {
console.log('ACTS_GetWant_2300 error: ' + JSON.stringify(error))
expect.assertFail()
done();
})
})
}
// @tc.number: ACTS_GetWant_2400
// @tc.name: getWant : get want in current ability
......@@ -1354,6 +1402,14 @@ describe('ActsGetWantTest', function () {
},
},
(err, data) => {
checkOnAbilityResult2400(data);
setTimeout(()=>{
done();
}, TIMEOUT_NUMBER);
})
})
function checkOnAbilityResult2400(data) {
console.info('====> ACTS_GetWant_2400 start ability=====>' + JSON.stringify(data))
expect(data.want.deviceId).assertEqual("");
expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap");
......@@ -1376,11 +1432,7 @@ describe('ActsGetWantTest', function () {
expect(data.want.parameters.mykey5[1]).assertEqual("STR");
expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony");
console.info('====> ACTS_GetWant_2400 setTimeout before done.=====>')
setTimeout(()=>{
done();
}, TIMEOUT_NUMBER);
})
})
}
/*
* @tc.number ACTS_GetWant_2500
......@@ -1411,6 +1463,18 @@ describe('ActsGetWantTest', function () {
},
},
}).then((data) => {
checkOnAbilityResult2500(data);
setTimeout(()=>{
done();
}, TIMEOUT_NUMBER);
}).catch((error) => {
console.log('ACTS_GetWant_2500 error: ' + JSON.stringify(error))
expect.assertFail()
done();
})
});
function checkOnAbilityResult2500(data) {
console.info('====> ACTS_GetWant_2500 start ability=====>' + JSON.stringify(data))
expect(data.want.deviceId).assertEqual("");
expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap");
......@@ -1433,15 +1497,7 @@ describe('ActsGetWantTest', function () {
expect(data.want.parameters.mykey5[1]).assertEqual("test123");
expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmony");
console.info('====> ACTS_GetWant_2500 before done=====>')
setTimeout(()=>{
done();
}, TIMEOUT_NUMBER);
}).catch((error) => {
console.log('ACTS_GetWant_2500 error: ' + JSON.stringify(error))
expect.assertFail()
done();
})
});
}
/*
* @tc.number ACTS_GetWant_2600
......@@ -1473,6 +1529,14 @@ describe('ActsGetWantTest', function () {
},
},
(err, data) => {
checkOnAbilityResult2600(data);
setTimeout(()=>{
done();
}, TIMEOUT_NUMBER);
})
});
function checkOnAbilityResult2600(data) {
console.info('====> ACTS_GetWant_2600 start ability=====>' + JSON.stringify(data))
expect(data.want.deviceId).assertEqual("");
expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap");
......@@ -1495,11 +1559,7 @@ describe('ActsGetWantTest', function () {
expect(data.want.parameters.mykey5[1]).assertEqual("test123");
expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmony");
console.info('====> ACTS_GetWant_2600 before done=====>')
setTimeout(()=>{
done();
}, TIMEOUT_NUMBER);
})
});
}
/**
* @tc.number: SUB_AA_OpenHarmony_wantConstantEnumeration_0100
......
......@@ -95,8 +95,15 @@ describe('ActsBundleManagerTest', function () {
*/
it('getBundleInfo_0200', 0, async function (done) {
await demo.getBundleInfo(NAME1,
demo.BundleFlag.GET_BUNDLE_WITH_ABILITIES | demo.BundleFlag.GET_BUNDLE_WITH_REQUESTED_PERMISSION, OnReceiveEvent);
demo.BundleFlag.GET_BUNDLE_WITH_ABILITIES | demo.BundleFlag.GET_BUNDLE_WITH_REQUESTED_PERMISSION,
OnReceiveEvent);
function OnReceiveEvent(err, datainfo) {
checkBundleInfo0200(datainfo)
done();
}
})
function checkBundleInfo0200(datainfo) {
console.info("getBundleInfo_0200 dataInfo ====" + datainfo);
expect(datainfo.name).assertEqual(NAME1);
expect(datainfo.vendor).assertEqual("example");
......@@ -141,9 +148,7 @@ describe('ActsBundleManagerTest', function () {
expect(datainfo.appInfo.moduleInfos[j].moduleSourceDir).assertEqual(DIR1);
}
expect(datainfo.appInfo.enabled).assertEqual(true);
done();
}
})
/**
* @tc.number getBundleInfo_0300
......@@ -415,39 +420,14 @@ describe('ActsBundleManagerTest', function () {
}
})
/**
* @tc.number getBundleInfo_1300
* @tc.name BUNDLE::getBundleInfo
* @tc.desc Test getBundleInfo interfaces with LAUNCHER hap. (by promise)
*/
it('getBundleInfo_1300', 0, async function (done) {
await demo.getBundleInfo(LAUNCHER, demo.BundleFlag.GET_BUNDLE_WITH_ABILITIES).then(datainfo => {
console.info("getBundleInfo_1300 success:" + JSON.stringify(datainfo));
expect(datainfo.name).assertEqual(LAUNCHER);
expect(datainfo.vendor).assertEqual("ohos");
expect(datainfo.versionCode).assertEqual(1000000);
expect(datainfo.versionName.length).assertLarger(0);
expect(datainfo.uid).assertLarger(2099);
expect(datainfo.appInfo.name).assertEqual(LAUNCHER);
expect(datainfo.appInfo.systemApp).assertEqual(true);
expect(datainfo.appInfo.supportedModes).assertEqual(0);
expect(datainfo.appInfo.moduleInfos.length).assertLarger(0);
expect(datainfo.appInfo.enabled).assertEqual(true);
done();
}).catch(err => {
console.info("getBundleInfo_1300 fail:" + JSON.stringify(err));
expect(err).assertFail();
done();
})
})
/**
* @tc.number getBundleInfo_1400
* @tc.name BUNDLE::getBundleInfo
* @tc.desc Test getBundleInfo interfaces with LAUNCHER hap.(by callback)
*/
it('getBundleInfo_1400', 0, async function (done) {
await demo.getBundleInfo(LAUNCHER, demo.BundleFlag.GET_BUNDLE_WITH_ABILITIES, bundleOptions, (err, dataInfo) => {
await demo.getBundleInfo(LAUNCHER, demo.BundleFlag.GET_BUNDLE_WITH_ABILITIES,
bundleOptions, (err, dataInfo) => {
if (err) {
console.info("getBundleInfo_1400 fail:" + JSON.stringify(err));
expect(err).assertFail();
......@@ -1033,7 +1013,8 @@ describe('ActsBundleManagerTest', function () {
* @tc.desc Test getApplicationInfo interfaces with one hap. (by promise)
*/
it('getApplicationInfo_1300', 0, async function (done) {
await demo.getApplicationInfo(NAME1, demo.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, USERID).then(datainfo => {
await demo.getApplicationInfo(NAME1, demo.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION,
USERID).then(datainfo => {
console.info("getApplicationInfo_1300 success:" + JSON.stringify(datainfo));
expect(typeof datainfo).assertEqual(OBJECT);
expect(datainfo.name).assertEqual(NAME1);
......@@ -1454,7 +1435,7 @@ describe('ActsBundleManagerTest', function () {
}, demo.BundleFlag.GET_ABILITY_INFO_WITH_APPLICATION |
demo.BundleFlag.GET_ABILITY_INFO_WITH_PERMISSION |
demo.BundleFlag.GET_ABILITY_INFO_WITH_METADATA,
USERID, (error, datainfo) => {
USERID, (error, data) => {
if (err) {
console.info("queryAbilityByWant_0200 err" + JSON.stringify(err));
expect(err).assertFail();
......@@ -1547,7 +1528,7 @@ describe('ActsBundleManagerTest', function () {
{
"bundleName": "com.example.myapplication2",
"abilityName": "com.example.myapplication1.MainAbility",
}, demo.BundleFlag.GET_ALL_APPLICATION_INFO, USERID, (error, datainfo) => {
}, demo.BundleFlag.GET_ALL_APPLICATION_INFO, USERID, (error, data) => {
expect(data.length).assertLarger(0);
for (let i = 0, len = data.length; i < len; i++) {
let datainfo = data[i];
......@@ -1588,6 +1569,16 @@ describe('ActsBundleManagerTest', function () {
await demo.queryAbilityByWant({
entities: ['entity.system.home', 'entitiesentities']
}, 4, USERID).then(data => {
checkAbilityInfo0500(data)
done();
}).catch(err => {
console.info("queryAbilityByWant_0500 err" + JSON.stringify(err));
expect(err).assertFail();
done();
})
})
function checkAbilityInfo0500(data) {
let queryResultCount = 0;
for (let i = 0, len = data.length; i < len; i++) {
let datainfo = data[i];
......@@ -1629,13 +1620,7 @@ describe('ActsBundleManagerTest', function () {
}
}
expect(queryResultCount).assertEqual(3);
done();
}).catch(err => {
console.info("queryAbilityByWant_0500 err" + JSON.stringify(err));
expect(err).assertFail();
done();
})
})
}
/**
* @tc.number queryAbilityByWant_0600
......@@ -1646,13 +1631,19 @@ describe('ActsBundleManagerTest', function () {
await demo.queryAbilityByWant(
{
entities: ['entity.system.home', 'entitiesentities']
}, 4, USERID, (err, datainfo) => {
}, 4, USERID, (err, data) => {
if (err) {
console.info("queryAbilityByWant_0600 err" + JSON.stringify(err));
expect(err).assertFail();
done();
return;
}
checkAbilityInfo0600(data);
done();
})
})
function checkAbilityInfo0600(data) {
let queryResultCount = 0;
for (let i = 0, len = data.length; i < len; i++) {
let datainfo = data[i];
......@@ -1694,9 +1685,7 @@ describe('ActsBundleManagerTest', function () {
}
}
expect(queryResultCount).assertEqual(3);
done();
})
})
}
/**
* @tc.number queryAbilityByWant_0700
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册