提交 9bca7c1a 编写于 作者: I inter515

新增用例+用例名称整改

Signed-off-by: Ninter515 <ry.renyi@huawei.com>
上级 1a9f665d
......@@ -23,12 +23,12 @@ const ERR_MERSSAGE = 'value is not an available number';
export default function ActsBmsHasInstalldTest() {
describe('ActsBmsHasInstalldTest', function () {
/**
* @tc.number hasInstalled_0100
* @tc.name Package::hasInstalled
/*
* @tc.number SUB_BMS_HAP_STATUS_0001
* @tc.name testHasInstalled
* @tc.desc Test hasInstalled interface.
*/
it('hasInstalled_0100', 0, async function (done) {
it('testHasInstalled', 0, async function (done) {
let flag = 0;
pkg.hasInstalled({
bundleName: 'com.example.third2',
......@@ -49,54 +49,73 @@ describe('ActsBmsHasInstalldTest', function () {
});
});
/**
* @tc.number hasInstalled_0200
* @tc.name Package::hasInstalled
* @tc.desc Test hasInstalled interface.
/*
* @tc.number SUB_BMS_HAP_STATUS_0002
* @tc.name testHasInstalledNoSuccess
* @tc.desc Test hasInstalled interface without success function.
*/
it('hasInstalled_0200', 0, async function (done) {
let flag = 0;
it('testHasInstalledNoSuccess', 0, async function (done) {
pkg.hasInstalled({
bundleName: 'wrongName',
success: function success(data) {
console.info('hasInstalled success function in');
flag += 1;
expect(data.result).assertFalse();
},
bundleName: 'com.example.third2',
fail: function fail(data, code) {
console.info('hasInstalled fail function in');
expect().assertFail();
},
complete: function complete() {
console.info('hasInstalled complete function in');
expect(flag).assertEqual(1);
done();
}
});
});
/**
* @tc.number hasInstalled_0300
* @tc.name Package::hasInstalled
* @tc.desc Test hasInstalled interface.
/*
* @tc.number SUB_BMS_HAP_STATUS_0003
* @tc.name testHasInstalledNoFailComplete
* @tc.desc Test hasInstalled without fail function and complete function.
*/
it('hasInstalled_0300', 0, async function (done) {
it('testHasInstalledNoFailComplete', 0, async function (done) {
pkg.hasInstalled({
bundleName: 'wrongName',
bundleName: 'com.example.third2',
success: function success(data) {
console.info('hasInstalled success function in');
expect(data.result).assertTrue();
done();
}
});
});
/*
* @tc.number SUB_BMS_HAP_STATUS_0004
* @tc.name hasInstalledHapNotExist
* @tc.desc Test hasInstalled when hap not exist.
*/
it('hasInstalledHapNotExist', 0, async function (done) {
let flag = 0;
pkg.hasInstalled({
bundleName: 'wrongName',
success: function success(data) {
console.info('hasInstalled success function in' + JSON.stringify(data));
flag += 1;
expect(data.result).assertFalse();
},
fail: function fail(data, code) {
console.info('hasInstalled fail function in');
expect().assertFail();
},
complete: function complete() {
console.info('hasInstalled complete function in');
expect(flag).assertEqual(1);
done();
}
});
});
/**
* @tc.number hasInstalled_0400
* @tc.name Package::hasInstalled
* @tc.desc Test hasInstalled interface.
/*
* @tc.number SUB_BMS_HAP_STATUS_0007
* @tc.name testHasInstalledNumberParam
* @tc.desc Test hasInstalled when bundleName is number.
*/
it('hasInstalled_0400', 0, async function (done) {
it('testHasInstalledNumberParam', 0, async function (done) {
let flag = 0;
pkg.hasInstalled({
bundleName: NUM_TWO,
......@@ -111,41 +130,97 @@ describe('ActsBmsHasInstalldTest', function () {
expect(code).assertEqual(ERR_CODE);
},
complete: function complete() {
flag += 3;
console.info('hasInstalled complete function in');
expect(flag).assertEqual(5)
expect(flag).assertEqual(2)
done();
}
});
});
/*
* @tc.number: hasInstalled_0500
* @tc.name: test hasInstalled bundleName is number
* @tc.desc: test hasInstalled bundleName is number without function fail
* @tc.level 3
*/
it('hasInstalled_0500', 0, async function (done) {
* @tc.number SUB_BMS_HAP_STATUS_0008
* @tc.name testHasInstalledFailNotExist
* @tc.desc Test hasInstalled without function fail.
*/
it('testHasInstalledFailNotExist', 0, async function (done) {
pkg.hasInstalled({
bundleName: NUM_TWO,
success: function success(data) {
console.info('hasInstalled success' + JSON.stringify(data));
expect(error).assertFail();
console.info('hasInstalled success function in');
expect().assertFail();
},
complete: function complete() {
console.info('hasInstalled complete');
console.info('hasInstalled complete function in');
done();
}
})
});
});
/*
* @tc.number SUB_BMS_HAP_STATUS_0009
* @tc.name testHasInstalledCompleteNotExit
* @tc.desc Test hasInstalled without function complete.
*/
it('testHasInstalledCompleteNotExit', 0, async function (done) {
pkg.hasInstalled({
bundleName: undefined,
success: function success(data) {
console.info('hasInstalled success function in');
expect().assertFail();
done();
},
fail: function fail(data, code) {
console.info('hasInstalled fail function in');
expect(data).assertEqual(ERR_MERSSAGE);
expect(code).assertEqual(ERR_CODE);
done();
}
});
});
/*
* @tc.number SUB_BMS_HAP_STATUS_0010
* @tc.name testHasInstalledReturnNotExist
* @tc.desc Test hasInstalled without function fail and function complete.
*/
it('testHasInstalledReturnNotExist', 0, async function (done) {
let status = "normal";
pkg.hasInstalled({
bundleName: NUM_TWO,
success: function success(data) {
status = "success";
console.info('hasInstalled success function in');
expect().assertFail();
}
});
await sleep(500);
expect(status).assertEqual("normal");
done();
});
/*
* @tc.number SUB_BMS_HAP_STATUS_0013
* @tc.name testHasInstalledNoFailCompleteBundleNotExist
* @tc.desc Test hasInstalled interface without function fail and function complete bundleName not exiet
*/
it('testHasInstalledNoFailCompleteBundleNotExist', 0, async function (done) {
pkg.hasInstalled({
bundleName: 'wrongName',
success: function success(data) {
console.info('hasInstalled success function in');
expect(data.result).assertFalse();
done();
}
});
});
/*
* @tc.number: hasInstalled_0600
* @tc.name: test hasInstalled bundleName is number
* @tc.number: SUB_BMS_HAP_STATUS_0014
* @tc.name: testHasInstalledInvalidParamCompleteNotExit
* @tc.desc: test hasInstalled bundleName is number without function complete
* @tc.level 3
*/
it('hasInstalled_0600', 0, async function (done) {
it('testHasInstalledInvalidParamCompleteNotExit', 0, async function (done) {
pkg.hasInstalled({
bundleName: NUM_TWO,
success: function success(data) {
......@@ -161,4 +236,14 @@ describe('ActsBmsHasInstalldTest', function () {
}
})
});
async function sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
})}
......@@ -32,54 +32,54 @@ const PROFILE_JSON_STRING = "{\"src\":[\"MainAbility/pages/index/index\",\"MainA
export default function getProfileByAbility() {
describe('getProfileByAbility', function () {
/*
* @tc.number: getProfileByAbility_0400
* @tc.name: getProfileByAbility : The profile is obtained by specified ability
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0021
* @tc.name: getProfileByAbilityInvalidModulePro
* @tc.desc: Check the invalid moduleName (by promise)
* @tc.level 0
*/
it('getProfileByAbility_0400', 0, async function (done) {
it('getProfileByAbilityInvalidModulePro', 0, async function (done) {
await bundle.getProfileByAbility(MODULE_NAME_TEST, ABILITY_NAME, METADATA_NAME).then(data => {
console.info("getProfileByAbility_0400 success" + JSON.stringify(data))
console.info("getProfileByAbilityInvalidModulePro success" + JSON.stringify(data))
expect(data).assertFail()
done()
}).catch(err => {
console.info("getProfileByAbility_0400 failed" + JSON.stringify(err))
console.info("getProfileByAbilityInvalidModulePro failed" + JSON.stringify(err))
expect(err).assertEqual(1)
done()
})
})
/*
* @tc.number: getProfileByAbility_0500
* @tc.name: getProfileByAbility : The profile is obtained by specified ability
* @tc.desc: Check the invalid moduleName (by promise)
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0031
* @tc.name: getProfileByAbilityEmptyModulePro
* @tc.desc: Check the empty moduleName (by promise)
* @tc.level 0
*/
it('getProfileByAbility_0500', 0, async function (done) {
it('getProfileByAbilityEmptyModulePro', 0, async function (done) {
await bundle.getProfileByAbility('', ABILITY_NAME, METADATA_NAME).then(data => {
console.info("getProfileByAbility_0500 success" + JSON.stringify(data))
console.info("getProfileByAbilityEmptyModulePro success" + JSON.stringify(data))
expect(data).assertFail()
done()
}).catch(err => {
console.info("getProfileByAbility_0500 failed" + JSON.stringify(err))
console.info("getProfileByAbilityEmptyModulePro failed" + JSON.stringify(err))
expect(err).assertEqual(1)
done()
})
})
/*
* @tc.number: getProfileByAbility_0600
* @tc.name: getProfileByAbility : The profile is obtained by specified ability
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0028
* @tc.name: getProfileByAbilityInvalidModuleCall
* @tc.desc: Check the invalid moduleName (by callback)
* @tc.level 0
*/
it('getProfileByAbility_0600', 0, async function (done) {
it('getProfileByAbilityInvalidModuleCall', 0, async function (done) {
bundle.getProfileByAbility(MODULE_NAME_TEST, ABILITY_NAME, METADATA_NAME, (err, data) => {
if (err) {
console.error('[getProfileByAbility_0600]Operation failed. Cause: ' + JSON.stringify(err));
console.error('[getProfileByAbilityInvalidModuleCall]Operation failed. Cause: ' + JSON.stringify(err));
expect(err).assertEqual(1);
}
console.info('[getProfileByAbility_0600] getApplicationInfo callback data is: ' + JSON.stringify(data));
console.info('[getProfileByAbilityInvalidModuleCall] getApplicationInfo callback data is: ' + JSON.stringify(data));
expect(typeof data).assertEqual("string");
expect(data).assertEqual("GetProfile failed");
done();
......@@ -87,18 +87,18 @@ export default function getProfileByAbility() {
})
/*
* @tc.number: getProfileByAbility_0700
* @tc.name: getProfileByAbility : The profile is obtained by specified ability
* @tc.desc: Check the invalid moduleName (by callback)
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0037
* @tc.name: getProfileByAbilityEmptyModuleCall
* @tc.desc: Check the empty moduleName (by callback)
* @tc.level 0
*/
it('getProfileByAbility_0700', 0, async function (done) {
it('getProfileByAbilityEmptyModuleCall', 0, async function (done) {
bundle.getProfileByAbility('', ABILITY_NAME, METADATA_NAME, (err, data) => {
if (err) {
console.error('[getProfileByAbility_0700]Operation failed. Cause: ' + JSON.stringify(err));
console.error('[getProfileByAbilityEmptyModuleCall]Operation failed. Cause: ' + JSON.stringify(err));
expect(err).assertEqual(1);
}
console.info('[getProfileByAbility_0700] getApplicationInfo callback data is: ' + JSON.stringify(data));
console.info('[getProfileByAbilityEmptyModuleCall] getApplicationInfo callback data is: ' + JSON.stringify(data));
expect(typeof data).assertEqual("string");
expect(data).assertEqual("GetProfile failed");
done();
......@@ -106,54 +106,54 @@ export default function getProfileByAbility() {
})
/*
* @tc.number: getProfileByAbility_0800
* @tc.name: getProfileByAbility : The profile is obtained by specified ability
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0013
* @tc.name: getProfileByAbilityInvalidAbilityPro
* @tc.desc: Check the invalid abilityName (by promise)
* @tc.level 0
*/
it('getProfileByAbility_0800', 0, async function (done) {
it('getProfileByAbilityInvalidAbilityPro', 0, async function (done) {
await bundle.getProfileByAbility(MODULE_NAME, ABILITY_NAME_TEST, METADATA_NAME).then(data => {
console.info("getProfileByAbility_0800 success" + JSON.stringify(data))
console.info("getProfileByAbilityInvalidAbilityPro success" + JSON.stringify(data))
expect(data).assertFail()
done()
}).catch(err => {
console.info("getProfileByAbility_0800 failed" + JSON.stringify(err))
console.info("getProfileByAbilityInvalidAbilityPro failed" + JSON.stringify(err))
expect(err).assertEqual(1)
done()
})
})
/*
* @tc.number: getProfileByAbility_0900
* @tc.name: getProfileByAbility : The profile is obtained by specified ability
* @tc.desc: Check the invalid abilityName (by promise)
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0032
* @tc.name: getProfileByAbilityEmptyAbilityPro
* @tc.desc: Check the empty abilityName (by promise)
* @tc.level 0
*/
it('getProfileByAbility_0900', 0, async function (done) {
it('getProfileByAbilityEmptyAbilityPro', 0, async function (done) {
await bundle.getProfileByAbility(MODULE_NAME, '', METADATA_NAME).then(data => {
console.info("getProfileByAbility_0900 success" + JSON.stringify(data))
console.info("getProfileByAbilityEmptyAbilityPro success" + JSON.stringify(data))
expect(data).assertFail()
done()
}).catch(err => {
console.info("getProfileByAbility_0900 failed" + JSON.stringify(err))
console.info("getProfileByAbilityEmptyAbilityPro failed" + JSON.stringify(err))
expect(err).assertEqual(1)
done()
})
})
/*
* @tc.number: getProfileByAbility_1000
* @tc.name: getProfileByAbility : The profile is obtained by specified ability
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0023
* @tc.name: getProfileByAbilityInvalidAbilityCall
* @tc.desc: Check the invalid abilityName (by callback)
* @tc.level 0
*/
it('getProfileByAbility_1000', 0, async function (done) {
it('getProfileByAbilityInvalidAbilityCall', 0, async function (done) {
bundle.getProfileByAbility(MODULE_NAME, ABILITY_NAME_TEST, METADATA_NAME, (err, data) => {
if (err) {
console.error('[getProfileByAbility_1000]Operation failed. Cause: ' + JSON.stringify(err));
console.error('[getProfileByAbilityInvalidAbilityCall]Operation failed. Cause: ' + JSON.stringify(err));
expect(err).assertEqual(1);
}
console.info('[getProfileByAbility_1000] getApplicationInfo callback data is: ' + JSON.stringify(data));
console.info('[getProfileByAbilityInvalidAbilityCall] getApplicationInfo callback data is: ' + JSON.stringify(data));
expect(typeof data).assertEqual("string");
expect(data).assertEqual("GetProfile failed");
done();
......@@ -161,18 +161,18 @@ export default function getProfileByAbility() {
})
/*
* @tc.number: getProfileByAbility_1100
* @tc.name: getProfileByAbility : The profile is obtained by specified ability
* @tc.desc: Check the invalid abilityName (by callback)
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0038
* @tc.name: getProfileByAbilityEmptyAbilityCall
* @tc.desc: Check the empty abilityName (by callback)
* @tc.level 0
*/
it('getProfileByAbility_1100', 0, async function (done) {
it('getProfileByAbilityEmptyAbilityCall', 0, async function (done) {
bundle.getProfileByAbility(MODULE_NAME, '', METADATA_NAME, (err, data) => {
if (err) {
console.error('[getProfileByAbility_1100]Operation failed. Cause: ' + JSON.stringify(err));
console.error('[getProfileByAbilityEmptyAbilityCall]Operation failed. Cause: ' + JSON.stringify(err));
expect(err).assertEqual(1);
}
console.info('[getProfileByAbility_1100] getApplicationInfo callback data is: ' + JSON.stringify(data));
console.info('[getProfileByAbilityEmptyAbilityCall] getApplicationInfo callback data is: ' + JSON.stringify(data));
expect(typeof data).assertEqual("string");
expect(data).assertEqual("GetProfile failed");
done();
......@@ -180,18 +180,18 @@ export default function getProfileByAbility() {
})
/*
* @tc.number: getProfileByAbility_1200
* @tc.name: getProfileByAbility : The profile is obtained by specified ability
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0025
* @tc.name: getProfileByAbilityCallback
* @tc.desc: Check the valid metadataName (by callback)
* @tc.level 0
*/
it('getProfileByAbility_1200', 0, async function (done) {
it('getProfileByAbilityCallback', 0, async function (done) {
bundle.getProfileByAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME, (err, data) => {
if (err) {
console.error('[getProfileByAbility_1200]Operation failed. Cause: ' + JSON.stringify(err));
console.error('[getProfileByAbilityCallback]Operation failed. Cause: ' + JSON.stringify(err));
expect(err).assertEqual(1);
}
console.info('[getProfileByAbility_1200] getApplicationInfo callback data is: ' + JSON.stringify(data));
console.info('[getProfileByAbilityCallback] getApplicationInfo callback data is: ' + JSON.stringify(data));
expect(Array.isArray(data)).assertTrue();
expect(typeof data[0]).assertEqual("string");
expect(data[0]).assertEqual(PROFILE_JSON_STRING);
......@@ -200,18 +200,18 @@ export default function getProfileByAbility() {
})
/*
* @tc.number: getProfileByAbility_1300
* @tc.name: getProfileByAbility : The profile is obtained by specified ability
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0027
* @tc.name: getProfileByAbilityInvalidMetaDataCall
* @tc.desc: Check the invalid metadataName (by callback)
* @tc.level 0
*/
it('getProfileByAbility_1300', 0, async function (done) {
it('getProfileByAbilityInvalidMetaDataCall', 0, async function (done) {
bundle.getProfileByAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME_TEST, (err, data) => {
if (err) {
console.error('[getProfileByAbility_1300]Operation failed. Cause: ' + JSON.stringify(err));
console.error('[getProfileByAbilityInvalidMetaDataCall]Operation failed. Cause: ' + JSON.stringify(err));
expect(err).assertEqual(1);
}
console.info('[getProfileByAbility_1300] getApplicationInfo callback data is: ' + JSON.stringify(data));
console.info('[getProfileByAbilityInvalidMetaDataCall] getApplicationInfo callback data is: ' + JSON.stringify(data));
expect(typeof data).assertEqual("string");
expect(data).assertEqual("GetProfile failed");
done();
......@@ -219,18 +219,18 @@ export default function getProfileByAbility() {
})
/*
* @tc.number: getProfileByAbility_1400
* @tc.name: getProfileByAbility : The profile is obtained by specified ability
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0039
* @tc.name: getProfileByAbilityEmptyMetaDataCall
* @tc.desc: Check the empty metadataName (by callback)
* @tc.level 0
*/
it('getProfileByAbility_1400', 0, async function (done) {
it('getProfileByAbilityEmptyMetaDataCall', 0, async function (done) {
bundle.getProfileByAbility(MODULE_NAME, ABILITY_NAME, '', (err, data) => {
if (err) {
console.error('[getProfileByAbility_1400]Operation failed. Cause: ' + JSON.stringify(err));
console.error('[getProfileByAbilityEmptyMetaDataCall]Operation failed. Cause: ' + JSON.stringify(err));
expect(err).assertEqual(1);
}
console.info('[getProfileByAbility_1400] getApplicationInfo callback data is: ' + JSON.stringify(data));
console.info('[getProfileByAbilityEmptyMetaDataCall] getApplicationInfo callback data is: ' + JSON.stringify(data));
expect(Array.isArray(data)).assertTrue();
expect(typeof data[0]).assertEqual("string");
expect(data[0]).assertEqual(PROFILE_JSON_STRING);
......@@ -241,52 +241,52 @@ export default function getProfileByAbility() {
})
/*
* @tc.number: getProfileByAbility_1500
* @tc.name: getProfileByAbility : The profile is obtained by specified ability
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0003
* @tc.name: getProfileByAbilityPromise
* @tc.desc: Check the valid metadataName (by promise)
* @tc.level 0
*/
it('getProfileByAbility_1500', 0, async function (done) {
it('getProfileByAbilityPromise', 0, async function (done) {
await bundle.getProfileByAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME).then(data => {
console.info('[getProfileByAbility_1500] getApplicationInfo callback data is: ' + JSON.stringify(data));
console.info('[getProfileByAbilityPromise] getApplicationInfo callback data is: ' + JSON.stringify(data));
expect(Array.isArray(data)).assertTrue();
expect(typeof data[0]).assertEqual("string");
expect(data[0]).assertEqual(PROFILE_JSON_STRING);
done();
}).catch(err => {
console.error('[getProfileByAbility_1500]Operation failed. Cause: ' + JSON.stringify(err));
console.error('[getProfileByAbilityPromise]Operation failed. Cause: ' + JSON.stringify(err));
expect(err).assertEqual(1);
done();
})
})
/*
* @tc.number: getProfileByAbility_1600
* @tc.name: getProfileByAbility : The profile is obtained by specified ability
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0016
* @tc.name: getProfileByAbilityInvalidMetaDataPro
* @tc.desc: Check the invalid metadataName (by promise)
* @tc.level 0
*/
it('getProfileByAbility_1600', 0, async function (done) {
it('getProfileByAbilityInvalidMetaDataPro', 0, async function (done) {
await bundle.getProfileByAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME_TEST).then(data => {
console.info('[getProfileByAbility_1600] getApplicationInfo callback data is: ' + JSON.stringify(data));
console.info('[getProfileByAbilityInvalidMetaDataPro] getApplicationInfo callback data is: ' + JSON.stringify(data));
expect(data).assertFail()
done()
}).catch(err => {
console.error('[getProfileByAbility_1600]Operation failed. Cause: ' + JSON.stringify(err));
console.error('[getProfileByAbilityInvalidMetaDataPro]Operation failed. Cause: ' + JSON.stringify(err));
expect(err).assertEqual(1);
done();
})
})
/*
* @tc.number: getProfileByAbility_1700
* @tc.name: getProfileByAbility : The profile is obtained by specified ability
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0033
* @tc.name: getProfileByAbilityEmptyMetaDataPro
* @tc.desc: Check the empty metadataName (by promise)
* @tc.level 0
*/
it('getProfileByAbility_1700', 0, async function (done) {
it('getProfileByAbilityEmptyMetaDataPro', 0, async function (done) {
await bundle.getProfileByAbility(MODULE_NAME, ABILITY_NAME, '').then(data => {
console.info('[getProfileByAbility_1700] getApplicationInfo callback data is: ' + JSON.stringify(data));
console.info('[getProfileByAbilityEmptyMetaDataPro] getApplicationInfo callback data is: ' + JSON.stringify(data));
expect(Array.isArray(data)).assertTrue();
expect(typeof data[0]).assertEqual("string");
expect(data[0]).assertEqual(PROFILE_JSON_STRING);
......@@ -294,21 +294,21 @@ export default function getProfileByAbility() {
expect(data[1]).assertEqual(PROFILE_JSON_STRING);
done();
}).catch(err => {
console.error('[getProfileByAbility_1700]Operation failed. Cause: ' + JSON.stringify(err));
console.error('[getProfileByAbilityEmptyMetaDataPro]Operation failed. Cause: ' + JSON.stringify(err));
expect(err).assertEqual(1);
done();
})
})
/*
* @tc.number: getProfileByAbility_1800
* @tc.name: getProfileByAbility : The profile is obtained by specified ability
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0010
* @tc.name: getProfileByAbilityNoMetaDataPro
* @tc.desc: without metadataName (by promise)
* @tc.level 0
*/
it('getProfileByAbility_1800', 0, async function (done) {
it('getProfileByAbilityNoMetaDataPro', 0, async function (done) {
await bundle.getProfileByAbility(MODULE_NAME, ABILITY_NAME).then(data => {
console.info('[getProfileByAbility_1800] getApplicationInfo callback data is: ' + JSON.stringify(data));
console.info('[getProfileByAbilityNoMetaDataPro] getApplicationInfo callback data is: ' + JSON.stringify(data));
expect(Array.isArray(data)).assertTrue();
expect(typeof data[0]).assertEqual("string");
expect(data[0]).assertEqual(PROFILE_JSON_STRING);
......@@ -316,61 +316,61 @@ export default function getProfileByAbility() {
expect(data[1]).assertEqual(PROFILE_JSON_STRING);
done();
}).catch(err => {
console.error('[getProfileByAbility_1800]Operation failed. Cause: ' + JSON.stringify(err));
console.error('[getProfileByAbilityNoMetaDataPro]Operation failed. Cause: ' + JSON.stringify(err));
expect(err).assertEqual(1);
done();
})
})
/*
* @tc.number: getProfileByAbility_1900
* @tc.name: getProfileByAbility : The profile is obtained by specified ability
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0049
* @tc.name: getProfileByAbilityNoProfilePro
* @tc.desc: no profile configured under the ability (by promise)
* @tc.level 0
*/
it('getProfileByAbility_1900', 0, async function (done) {
it('getProfileByAbilityNoProfilePro', 0, async function (done) {
await bundle.getProfileByAbility(MODULE_NAME, ABILITY_NAME1).then(data => {
console.info('[getProfileByAbility_1900] getApplicationInfo callback data is: ' + JSON.stringify(data));
console.info('[getProfileByAbilityNoProfilePro] getApplicationInfo callback data is: ' + JSON.stringify(data));
expect(data).assertFail()
done();
}).catch(err => {
console.error('[getProfileByAbility_1900]Operation failed. Cause: ' + JSON.stringify(err));
console.error('[getProfileByAbilityNoProfilePro]Operation failed. Cause: ' + JSON.stringify(err));
expect(err).assertEqual(1);
done();
})
})
/*
* @tc.number: getProfileByAbility_2000
* @tc.name: getProfileByAbility : The profile is obtained by specified ability
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0043
* @tc.name: getProfileByAbilityNotPrefixPro
* @tc.desc: resource has no prefix '$profile:' (by promise)
* @tc.level 0
*/
it('getProfileByAbility_2000', 0, async function (done) {
it('getProfileByAbilityNotPrefixPro', 0, async function (done) {
await bundle.getProfileByAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME2).then(data => {
console.info('[getProfileByAbility_2000] getApplicationInfo callback data is: ' + JSON.stringify(data));
console.info('[getProfileByAbilityNotPrefixPro] getApplicationInfo callback data is: ' + JSON.stringify(data));
expect(data).assertFail()
done();
}).catch(err => {
console.error('[getProfileByAbility_2000]Operation failed. Cause: ' + JSON.stringify(err));
console.error('[getProfileByAbilityNotPrefixPro]Operation failed. Cause: ' + JSON.stringify(err));
expect(err).assertEqual(1);
done();
})
})
/*
* @tc.number: getProfileByAbility_2100
* @tc.name: getProfileByAbility : The profile is obtained by specified ability
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0042
* @tc.name: getProfileByAbilityNotPrefixCall
* @tc.desc: resource has no prefix '$profile:' (by callback)
* @tc.level 0
*/
it('getProfileByAbility_2100', 0, async function (done) {
it('getProfileByAbilityNotPrefixCall', 0, async function (done) {
bundle.getProfileByAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME2, (err, data) => {
if (err) {
console.error('[getProfileByAbility_2100]Operation failed. Cause: ' + JSON.stringify(err));
console.error('[getProfileByAbilityNotPrefixCall]Operation failed. Cause: ' + JSON.stringify(err));
expect(err).assertEqual(1);
}
console.info('[getProfileByAbility_2100] getApplicationInfo callback data is: ' + JSON.stringify(data));
console.info('[getProfileByAbilityNotPrefixCall] getApplicationInfo callback data is: ' + JSON.stringify(data));
expect(typeof data).assertEqual("string");
expect(data).assertEqual("GetProfile failed");
done();
......@@ -378,37 +378,37 @@ export default function getProfileByAbility() {
})
/*
* @tc.number: getProfileByAbility_2200
* @tc.name: getProfileByAbility : The profile is obtained by specified ability
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0019
* @tc.name: getProfileByAbilityNotSuffixPro
* @tc.desc: profile is .txt suffix (by promise)
* @tc.level 0
*/
it('getProfileByAbility_2200', 0, async function (done) {
it('getProfileByAbilityNotSuffixPro', 0, async function (done) {
await bundle.getProfileByAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME3).then(data => {
console.info('[getProfileByAbility_2200] getApplicationInfo callback data is: ' + JSON.stringify(data));
console.info('[getProfileByAbilityNotSuffixPro] getApplicationInfo callback data is: ' + JSON.stringify(data));
expect(Array.isArray(data)).assertTrue();
expect(typeof data[0]).assertEqual("string");
done();
}).catch(err => {
console.error('[getProfileByAbility_2200]Operation failed. Cause: ' + JSON.stringify(err));
console.error('[getProfileByAbilityNotSuffixPro]Operation failed. Cause: ' + JSON.stringify(err));
expect().assertFail();
done();
})
})
/*
* @tc.number: getProfileByAbility_2300
* @tc.name: getProfileByAbility : The profile is obtained by specified ability
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0041
* @tc.name: getProfileByAbilityNotSuffixCall
* @tc.desc: profile is .txt suffix (by callback)
* @tc.level 0
*/
it('getProfileByAbility_2300', 0, async function (done) {
it('getProfileByAbilityNotSuffixCall', 0, async function (done) {
bundle.getProfileByAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME3, (err, data) => {
if (err) {
console.error('[getProfileByAbility_2300]Operation failed. Cause: ' + JSON.stringify(err));
console.error('[getProfileByAbilityNotSuffixCall]Operation failed. Cause: ' + JSON.stringify(err));
expect().assertFail();
}
console.info('[getProfileByAbility_2300] getApplicationInfo callback data is: ' + JSON.stringify(data));
console.info('[getProfileByAbilityNotSuffixCall] getApplicationInfo callback data is: ' + JSON.stringify(data));
expect(Array.isArray(data)).assertTrue();
expect(typeof data[0]).assertEqual("string");
done();
......@@ -416,34 +416,34 @@ export default function getProfileByAbility() {
})
/*
* @tc.number: getProfileByAbility_2400
* @tc.name: getProfileByAbility : The profile is obtained by specified ability
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0020
* @tc.name: getProfileByAbilityNoJsonPro
* @tc.desc: profile is invalid json format (by promise)
* @tc.level 0
*/
it('getProfileByAbility_2400', 0, async function (done) {
it('getProfileByAbilityNoJsonPro', 0, async function (done) {
await bundle.getProfileByAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME4).then(data => {
console.info('[getProfileByAbility_2400] data is: ' + JSON.stringify(data));
console.info('[getProfileByAbilityNoJsonPro] data is: ' + JSON.stringify(data));
expect().assertFail();
done();
}).catch(err => {
console.error('[getProfileByAbility_2400] Operation failed. Cause: ' + JSON.stringify(err));
console.error('[getProfileByAbilityNoJsonPro] Operation failed. Cause: ' + JSON.stringify(err));
expect(err).assertEqual(1);
done();
})
})
/*
* @tc.number: getProfileByAbility_2500
* @tc.name: getProfileByAbility : The profile is obtained by specified ability
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0047
* @tc.name: getProfileByAbilityNoJsonCall
* @tc.desc: profile is invalid json format (by callback)
* @tc.level 0
*/
it('getProfileByAbility_2500', 0, async function (done) {
it('getProfileByAbilityNoJsonCall', 0, async function (done) {
bundle.getProfileByAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME4, (err, data) => {
console.info('[getProfileByAbility_2500] err: ' + JSON.stringify(err));
console.info('[getProfileByAbilityNoJsonCall] err: ' + JSON.stringify(err));
expect(err).assertEqual(1);
console.info('[getProfileByAbility_2500] data is: ' + JSON.stringify(data));
console.info('[getProfileByAbilityNoJsonCall] data is: ' + JSON.stringify(data));
expect(typeof data).assertEqual("string");
expect(data).assertEqual("GetProfile failed");
done();
......
......@@ -32,54 +32,54 @@ const PROFILE_JSON_STRING = "{\"src\":[\"MainAbility/pages/index/index\",\"MainA
export default function getProfileByExtensionAbility() {
describe('getProfileByExtensionAbility', function () {
/*
* @tc.number: getProfileByExtensionAbility_0400
* @tc.name: getProfileByExtensionAbility : The profile is obtained by specified ability
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0011
* @tc.name: getProfileByExtensionInvalidModulePro
* @tc.desc: Check the invalid moduleName (by promise)
* @tc.level 0
*/
it('getProfileByExtensionAbility_0400', 0, async function (done) {
it('getProfileByExtensionInvalidModulePro', 0, async function (done) {
await bundle.getProfileByExtensionAbility(MODULE_NAME_TEST, ABILITY_NAME, METADATA_NAME).then(data => {
console.info("getProfileByExtensionAbility_0400 success" + JSON.stringify(data))
console.info("getProfileByExtensionInvalidModulePro success" + JSON.stringify(data))
expect(data).assertFail()
done()
}).catch(err => {
console.info("getProfileByExtensionAbility_0400 failed" + JSON.stringify(err))
console.info("getProfileByExtensionInvalidModulePro failed" + JSON.stringify(err))
expect(err).assertEqual(1)
done()
})
})
/*
* @tc.number: getProfileByExtensionAbility_0500
* @tc.name: getProfileByExtensionAbility : The profile is obtained by specified ability
* @tc.desc: Check the invalid moduleName (by promise)
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0015
* @tc.name: getProfileByExtensionEmptyModulePro
* @tc.desc: Check the Empty moduleName (by promise)
* @tc.level 0
*/
it('getProfileByExtensionAbility_0500', 0, async function (done) {
it('getProfileByExtensionEmptyModulePro', 0, async function (done) {
await bundle.getProfileByExtensionAbility('', ABILITY_NAME, METADATA_NAME).then(data => {
console.info("getProfileByExtensionAbility_0500 success" + JSON.stringify(data))
console.info("getProfileByExtensionEmptyModulePro success" + JSON.stringify(data))
expect(data).assertFail()
done()
}).catch(err => {
console.info("getProfileByExtensionAbility_0500 failed" + JSON.stringify(err))
console.info("getProfileByExtensionEmptyModulePro failed" + JSON.stringify(err))
expect(err).assertEqual(1)
done()
})
})
/*
* @tc.number: getProfileByExtensionAbility_0600
* @tc.name: getProfileByExtensionAbility : The profile is obtained by specified ability
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0017
* @tc.name: getProfileByExtensionEmptyModuleCall
* @tc.desc: Check the invalid moduleName (by callback)
* @tc.level 0
*/
it('getProfileByExtensionAbility_0600', 0, async function (done) {
it('getProfileByExtensionEmptyModuleCall', 0, async function (done) {
bundle.getProfileByExtensionAbility(MODULE_NAME_TEST, ABILITY_NAME, METADATA_NAME, (err, data) => {
if (err) {
console.error('[getProfileByExtensionAbility_0600]Operation failed. Cause: ' + JSON.stringify(err));
console.error('[getProfileByExtensionEmptyModuleCall]Operation failed. Cause: ' + JSON.stringify(err));
expect(err).assertEqual(1);
}
console.info('[getProfileByExtensionAbility_0600] getApplicationInfo callback data is: ' + JSON.stringify(data));
console.info('[getProfileByExtensionEmptyModuleCall] getApplicationInfo callback data is: ' + JSON.stringify(data));
expect(typeof data).assertEqual("string");
expect(data).assertEqual("GetProfile failed");
done();
......@@ -87,18 +87,18 @@ export default function getProfileByExtensionAbility() {
})
/*
* @tc.number: getProfileByExtensionAbility_0700
* @tc.name: getProfileByExtensionAbility : The profile is obtained by specified ability
* @tc.desc: Check the invalid moduleName (by callback)
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0034
* @tc.name: getProfileByExtensionEmptyModuleCall
* @tc.desc: Check the Empty moduleName (by callback)
* @tc.level 0
*/
it('getProfileByExtensionAbility_0700', 0, async function (done) {
it('getProfileByExtensionEmptyModuleCall', 0, async function (done) {
bundle.getProfileByExtensionAbility('', ABILITY_NAME, METADATA_NAME, (err, data) => {
if (err) {
console.error('[getProfileByExtensionAbility_0700]Operation failed. Cause: ' + JSON.stringify(err));
console.error('[getProfileByExtensionEmptyModuleCall]Operation failed. Cause: ' + JSON.stringify(err));
expect(err).assertEqual(1);
}
console.info('[getProfileByExtensionAbility_0700] getApplicationInfo callback data is: ' + JSON.stringify(data));
console.info('[getProfileByExtensionEmptyModuleCall] getApplicationInfo callback data is: ' + JSON.stringify(data));
expect(typeof data).assertEqual("string");
expect(data).assertEqual("GetProfile failed");
done();
......@@ -106,54 +106,54 @@ export default function getProfileByExtensionAbility() {
})
/*
* @tc.number: getProfileByExtensionAbility_0800
* @tc.name: getProfileByExtensionAbility : The profile is obtained by specified ability
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0012
* @tc.name: getProfileByExtensionInvalidAbilityPro
* @tc.desc: Check the invalid abilityName (by promise)
* @tc.level 0
*/
it('getProfileByExtensionAbility_0800', 0, async function (done) {
it('getProfileByExtensionInvalidAbilityPro', 0, async function (done) {
await bundle.getProfileByExtensionAbility(MODULE_NAME, ABILITY_NAME_TEST, METADATA_NAME).then(data => {
console.info("getProfileByExtensionAbility_0800 success" + JSON.stringify(data))
console.info("getProfileByExtensionInvalidAbilityPro success" + JSON.stringify(data))
expect(data).assertFail()
done()
}).catch(err => {
console.info("getProfileByExtensionAbility_0800 failed" + JSON.stringify(err))
console.info("getProfileByExtensionInvalidAbilityPro failed" + JSON.stringify(err))
expect(err).assertEqual(1)
done()
})
})
/*
* @tc.number: getProfileByExtensionAbility_0900
* @tc.name: getProfileByExtensionAbility : The profile is obtained by specified ability
* @tc.desc: Check the invalid abilityName (by promise)
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0029
* @tc.name: getProfileByExtensionEmptyAbilityPro
* @tc.desc: Check the Empty abilityName (by promise)
* @tc.level 0
*/
it('getProfileByExtensionAbility_0900', 0, async function (done) {
it('getProfileByExtensionEmptyAbilityPro', 0, async function (done) {
await bundle.getProfileByExtensionAbility(MODULE_NAME, '', METADATA_NAME).then(data => {
console.info("getProfileByExtensionAbility_0900 success" + JSON.stringify(data))
console.info("getProfileByExtensionEmptyAbilityPro success" + JSON.stringify(data))
expect(data).assertFail()
done()
}).catch(err => {
console.info("getProfileByExtensionAbility_0900 failed" + JSON.stringify(err))
console.info("getProfileByExtensionEmptyAbilityPro failed" + JSON.stringify(err))
expect(err).assertEqual(1)
done()
})
})
/*
* @tc.number: getProfileByExtensionAbility_1000
* @tc.name: getProfileByExtensionAbility : The profile is obtained by specified ability
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0022
* @tc.name: getProfileByExtensionInvalidAbilityCall
* @tc.desc: Check the invalid abilityName (by callback)
* @tc.level 0
*/
it('getProfileByExtensionAbility_1000', 0, async function (done) {
it('getProfileByExtensionInvalidAbilityCall', 0, async function (done) {
bundle.getProfileByExtensionAbility(MODULE_NAME, ABILITY_NAME_TEST, METADATA_NAME, (err, data) => {
if (err) {
console.error('[getProfileByExtensionAbility_1000]Operation failed. Cause: ' + JSON.stringify(err));
console.error('[getProfileByExtensionInvalidAbilityCall]Operation failed. Cause: ' + JSON.stringify(err));
expect(err).assertEqual(1);
}
console.info('[getProfileByExtensionAbility_1000] getApplicationInfo callback data is: ' + JSON.stringify(data));
console.info('[getProfileByExtensionInvalidAbilityCall] getApplicationInfo callback data is: ' + JSON.stringify(data));
expect(typeof data).assertEqual("string");
expect(data).assertEqual("GetProfile failed");
done();
......@@ -161,18 +161,18 @@ export default function getProfileByExtensionAbility() {
})
/*
* @tc.number: getProfileByExtensionAbility_1100
* @tc.name: getProfileByExtensionAbility : The profile is obtained by specified ability
* @tc.desc: Check the invalid abilityName (by callback)
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0035
* @tc.name: getProfileByExtensionEmptyAbilityCall
* @tc.desc: Check the Empty abilityName (by callback)
* @tc.level 0
*/
it('getProfileByExtensionAbility_1100', 0, async function (done) {
it('getProfileByExtensionEmptyAbilityCall', 0, async function (done) {
bundle.getProfileByExtensionAbility(MODULE_NAME, '', METADATA_NAME, (err, data) => {
if (err) {
console.error('[getProfileByExtensionAbility_1100]Operation failed. Cause: ' + JSON.stringify(err));
console.error('[getProfileByExtensionEmptyAbilityCall]Operation failed. Cause: ' + JSON.stringify(err));
expect(err).assertEqual(1);
}
console.info('[getProfileByExtensionAbility_1100] getApplicationInfo callback data is: ' + JSON.stringify(data));
console.info('[getProfileByExtensionEmptyAbilityCall] getApplicationInfo callback data is: ' + JSON.stringify(data));
expect(typeof data).assertEqual("string");
expect(data).assertEqual("GetProfile failed");
done();
......@@ -180,18 +180,18 @@ export default function getProfileByExtensionAbility() {
})
/*
* @tc.number: getProfileByExtensionAbility_1200
* @tc.name: getProfileByExtensionAbility : The profile is obtained by specified ability
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0024
* @tc.name: getProfileByExtensionAbilityCallback
* @tc.desc: Check the valid metadataName (by callback)
* @tc.level 0
*/
it('getProfileByExtensionAbility_1200', 0, async function (done) {
it('getProfileByExtensionAbilityCallback', 0, async function (done) {
bundle.getProfileByExtensionAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME, (err, data) => {
if (err) {
console.error('[getProfileByExtensionAbility_1200]Operation failed. Cause: ' + JSON.stringify(err));
console.error('[getProfileByExtensionAbilityCallback]Operation failed. Cause: ' + JSON.stringify(err));
expect(err).assertEqual(1);
}
console.info('[getProfileByExtensionAbility_1200] getApplicationInfo callback data is: ' + JSON.stringify(data));
console.info('[getProfileByExtensionAbilityCallback] getApplicationInfo callback data is: ' + JSON.stringify(data));
expect(Array.isArray(data)).assertTrue();
expect(typeof data[0]).assertEqual("string");
expect(data[0]).assertEqual(PROFILE_JSON_STRING);
......@@ -200,18 +200,18 @@ export default function getProfileByExtensionAbility() {
})
/*
* @tc.number: getProfileByExtensionAbility_1300
* @tc.name: getProfileByExtensionAbility : The profile is obtained by specified ability
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0026
* @tc.name: getProfileByExtensionInvalidMetaDataCall
* @tc.desc: Check the invalid metadataName (by callback)
* @tc.level 0
*/
it('getProfileByExtensionAbility_1300', 0, async function (done) {
it('getProfileByExtensionInvalidMetaDataCall', 0, async function (done) {
bundle.getProfileByExtensionAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME_TEST, (err, data) => {
if (err) {
console.error('[getProfileByExtensionAbility_1300]Operation failed. Cause: ' + JSON.stringify(err));
console.error('[getProfileByExtensionInvalidMetaDataCall]Operation failed. Cause: ' + JSON.stringify(err));
expect(err).assertEqual(1);
}
console.info('[getProfileByExtensionAbility_1300] getApplicationInfo callback data is: ' + JSON.stringify(data));
console.info('[getProfileByExtensionInvalidMetaDataCall] getApplicationInfo callback data is: ' + JSON.stringify(data));
expect(typeof data).assertEqual("string");
expect(data).assertEqual("GetProfile failed");
done();
......@@ -219,18 +219,18 @@ export default function getProfileByExtensionAbility() {
})
/*
* @tc.number: getProfileByExtensionAbility_1400
* @tc.name: getProfileByExtensionAbility : The profile is obtained by specified ability
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0036
* @tc.name: getProfileByExtensionEmptyMetaDataCall
* @tc.desc: Check the empty metadataName (by callback)
* @tc.level 0
*/
it('getProfileByExtensionAbility_1400', 0, async function (done) {
it('getProfileByExtensionEmptyMetaDataCall', 0, async function (done) {
bundle.getProfileByExtensionAbility(MODULE_NAME, ABILITY_NAME, '', (err, data) => {
if (err) {
console.error('[getProfileByExtensionAbility_1400]Operation failed. Cause: ' + JSON.stringify(err));
console.error('[getProfileByExtensionEmptyMetaDataCall]Operation failed. Cause: ' + JSON.stringify(err));
expect(err).assertEqual(1);
}
console.info('[getProfileByExtensionAbility_1400] getApplicationInfo callback data is: ' + JSON.stringify(data));
console.info('[getProfileByExtensionEmptyMetaDataCall] getApplicationInfo callback data is: ' + JSON.stringify(data));
expect(Array.isArray(data)).assertTrue();
expect(typeof data[0]).assertEqual("string");
expect(data[0]).assertEqual(PROFILE_JSON_STRING);
......@@ -241,52 +241,52 @@ export default function getProfileByExtensionAbility() {
})
/*
* @tc.number: getProfileByExtensionAbility_1500
* @tc.name: getProfileByExtensionAbility : The profile is obtained by specified ability
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0002
* @tc.name: getProfileByExtensionAbilityPromise
* @tc.desc: Check the valid metadataName (by promise)
* @tc.level 0
*/
it('getProfileByExtensionAbility_1500', 0, async function (done) {
it('getProfileByExtensionAbilityPromise', 0, async function (done) {
await bundle.getProfileByExtensionAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME).then(data => {
console.info('[getProfileByExtensionAbility_1500] getApplicationInfo callback data is: ' + JSON.stringify(data));
console.info('[getProfileByExtensionAbilityPromise] getApplicationInfo callback data is: ' + JSON.stringify(data));
expect(Array.isArray(data)).assertTrue();
expect(typeof data[0]).assertEqual("string");
expect(data[0]).assertEqual(PROFILE_JSON_STRING);
done();
}).catch(err => {
console.error('[getProfileByExtensionAbility_1500]Operation failed. Cause: ' + JSON.stringify(err));
console.error('[getProfileByExtensionAbilityPromise]Operation failed. Cause: ' + JSON.stringify(err));
expect(err).assertEqual(1);
done();
})
})
/*
* @tc.number: getProfileByExtensionAbility_1600
* @tc.name: getProfileByExtensionAbility : The profile is obtained by specified ability
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0004
* @tc.name: getProfileByExtensionInvalidMetaDataPro
* @tc.desc: Check the invalid metadataName (by promise)
* @tc.level 0
*/
it('getProfileByExtensionAbility_1600', 0, async function (done) {
it('getProfileByExtensionInvalidMetaDataPro', 0, async function (done) {
await bundle.getProfileByExtensionAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME_TEST).then(data => {
console.info('[getProfileByExtensionAbility_1600] getApplicationInfo callback data is: ' + JSON.stringify(data));
console.info('[getProfileByExtensionInvalidMetaDataPro] getApplicationInfo callback data is: ' + JSON.stringify(data));
expect(data).assertFail()
done()
}).catch(err => {
console.error('[getProfileByExtensionAbility_1600]Operation failed. Cause: ' + JSON.stringify(err));
console.error('[getProfileByExtensionInvalidMetaDataPro]Operation failed. Cause: ' + JSON.stringify(err));
expect(err).assertEqual(1);
done();
})
})
/*
* @tc.number: getProfileByExtensionAbility_1700
* @tc.name: getProfileByExtensionAbility : The profile is obtained by specified ability
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0030
* @tc.name: getProfileByExtensionEmptyMetaDataPro
* @tc.desc: Check the empty metadataName (by promise)
* @tc.level 0
*/
it('getProfileByExtensionAbility_1700', 0, async function (done) {
it('getProfileByExtensionEmptyMetaDataPro', 0, async function (done) {
await bundle.getProfileByExtensionAbility(MODULE_NAME, ABILITY_NAME, '').then(data => {
console.info('[getProfileByExtensionAbility_1700] getApplicationInfo callback data is: ' + JSON.stringify(data));
console.info('[getProfileByExtensionEmptyMetaDataPro] getApplicationInfo callback data is: ' + JSON.stringify(data));
expect(Array.isArray(data)).assertTrue();
expect(typeof data[0]).assertEqual("string");
expect(data[0]).assertEqual(PROFILE_JSON_STRING);
......@@ -294,21 +294,21 @@ export default function getProfileByExtensionAbility() {
expect(data[1]).assertEqual(PROFILE_JSON_STRING);
done();
}).catch(err => {
console.error('[getProfileByExtensionAbility_1700]Operation failed. Cause: ' + JSON.stringify(err));
console.error('[getProfileByExtensionEmptyMetaDataPro]Operation failed. Cause: ' + JSON.stringify(err));
expect(err).assertEqual(1);
done();
})
})
/*
* @tc.number: getProfileByExtensionAbility_1800
* @tc.name: getProfileByExtensionAbility : The profile is obtained by specified ability
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0009
* @tc.name: getProfileByExtensionAbilityNoMetaDataPro
* @tc.desc: without metadataName (by promise)
* @tc.level 0
*/
it('getProfileByExtensionAbility_1800', 0, async function (done) {
it('getProfileByExtensionAbilityNoMetaDataPro', 0, async function (done) {
await bundle.getProfileByExtensionAbility(MODULE_NAME, ABILITY_NAME).then(data => {
console.info('[getProfileByExtensionAbility_1800] getApplicationInfo callback data is: ' + JSON.stringify(data));
console.info('[getProfileByExtensionAbilityNoMetaDataPro] getApplicationInfo callback data is: ' + JSON.stringify(data));
expect(Array.isArray(data)).assertTrue();
expect(typeof data[0]).assertEqual("string");
expect(data[0]).assertEqual(PROFILE_JSON_STRING);
......@@ -316,61 +316,61 @@ export default function getProfileByExtensionAbility() {
expect(data[1]).assertEqual(PROFILE_JSON_STRING);
done();
}).catch(err => {
console.error('[getProfileByExtensionAbility_1800]Operation failed. Cause: ' + JSON.stringify(err));
console.error('[getProfileByExtensionAbilityNoMetaDataPro]Operation failed. Cause: ' + JSON.stringify(err));
expect(err).assertEqual(1);
done();
})
})
/*
* @tc.number: getProfileByExtensionAbility_1900
* @tc.name: getProfileByExtensionAbility : The profile is obtained by specified ability
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0048
* @tc.name: getProfileByExtensionAbilityNoProfilePro
* @tc.desc: no profile configured under the ability (by promise)
* @tc.level 0
*/
it('getProfileByExtensionAbility_1900', 0, async function (done) {
it('getProfileByExtensionAbilityNoProfilePro', 0, async function (done) {
await bundle.getProfileByExtensionAbility(MODULE_NAME, ABILITY_NAME1).then(data => {
console.info('[getProfileByExtensionAbility_1900] getApplicationInfo callback data is: ' + JSON.stringify(data));
console.info('[getProfileByExtensionAbilityNoProfilePro] getApplicationInfo callback data is: ' + JSON.stringify(data));
expect(data).assertFail()
done();
}).catch(err => {
console.error('[getProfileByExtensionAbility_1900]Operation failed. Cause: ' + JSON.stringify(err));
console.error('[getProfileByExtensionAbilityNoProfilePro]Operation failed. Cause: ' + JSON.stringify(err));
expect(err).assertEqual(1);
done();
})
})
/*
* @tc.number: getProfileByExtensionAbility_2000
* @tc.name: getProfileByExtensionAbility : The profile is obtained by specified ability
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0045
* @tc.name: getProfileByExtensionNotPrefixPro
* @tc.desc: resource has no prefix '$profile:' (by promise)
* @tc.level 0
*/
it('getProfileByExtensionAbility_2000', 0, async function (done) {
it('getProfileByExtensionNotPrefixPro', 0, async function (done) {
await bundle.getProfileByExtensionAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME2).then(data => {
console.info('[getProfileByExtensionAbility_2000] getApplicationInfo callback data is: ' + JSON.stringify(data));
console.info('[getProfileByExtensionNotPrefixPro] getApplicationInfo callback data is: ' + JSON.stringify(data));
expect(data).assertFail()
done();
}).catch(err => {
console.error('[getProfileByExtensionAbility_2000]Operation failed. Cause: ' + JSON.stringify(err));
console.error('[getProfileByExtensionNotPrefixPro]Operation failed. Cause: ' + JSON.stringify(err));
expect(err).assertEqual(1);
done();
})
})
/*
* @tc.number: getProfileByExtensionAbility_2100
* @tc.name: getProfileByExtensionAbility : The profile is obtained by specified ability
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0044
* @tc.name: getProfileByExtensionNotPrefixCall
* @tc.desc: resource has no prefix '$profile:' (by callback)
* @tc.level 0
*/
it('getProfileByExtensionAbility_2100', 0, async function (done) {
it('getProfileByExtensionNotPrefixCall', 0, async function (done) {
bundle.getProfileByExtensionAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME2, (err, data) => {
if (err) {
console.error('[getProfileByExtensionAbility_2100]Operation failed. Cause: ' + JSON.stringify(err));
console.error('[getProfileByExtensionNotPrefixCall]Operation failed. Cause: ' + JSON.stringify(err));
expect(err).assertEqual(1);
}
console.info('[getProfileByExtensionAbility_2100] getApplicationInfo callback data is: ' + JSON.stringify(data));
console.info('[getProfileByExtensionNotPrefixCall] getApplicationInfo callback data is: ' + JSON.stringify(data));
expect(typeof data).assertEqual("string");
expect(data).assertEqual("GetProfile failed");
done();
......@@ -378,37 +378,37 @@ export default function getProfileByExtensionAbility() {
})
/*
* @tc.number: getProfileByExtensionAbility_2200
* @tc.name: getProfileByExtensionAbility : The profile is obtained by specified ability
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0007
* @tc.name: getProfileByExtensionNotSuffixPro
* @tc.desc: profile is .txt suffix (by promise)
* @tc.level 0
*/
it('getProfileByExtensionAbility_2200', 0, async function (done) {
it('getProfileByExtensionNotSuffixPro', 0, async function (done) {
await bundle.getProfileByExtensionAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME3).then(data => {
console.info('[getProfileByExtensionAbility_2200] getApplicationInfo callback data is: ' + JSON.stringify(data));
console.info('[getProfileByExtensionNotSuffixPro] getApplicationInfo callback data is: ' + JSON.stringify(data));
expect(Array.isArray(data)).assertTrue();
expect(typeof data[0]).assertEqual("string");
done();
}).catch(err => {
console.error('[getProfileByExtensionAbility_2200]Operation failed. Cause: ' + JSON.stringify(err));
console.error('[getProfileByExtensionNotSuffixPro]Operation failed. Cause: ' + JSON.stringify(err));
expect().assertFail();
done();
})
})
/*
* @tc.number: getProfileByExtensionAbility_2300
* @tc.name: getProfileByExtensionAbility : The profile is obtained by specified ability
* @tc.desc: profile is invalid json format (by callback)
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0040
* @tc.name: getProfileByExtensionNotSuffixCall
* @tc.desc: profile is .txt suffix (by callback)
* @tc.level 0
*/
it('getProfileByExtensionAbility_2300', 0, async function (done) {
it('getProfileByExtensionNotSuffixCall', 0, async function (done) {
bundle.getProfileByExtensionAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME3, (err, data) => {
if (err) {
console.error('[getProfileByExtensionAbility_2300]Operation failed. Cause: ' + JSON.stringify(err));
console.error('[getProfileByExtensionNotSuffixCall]Operation failed. Cause: ' + JSON.stringify(err));
expect().assertFail();
}
console.info('[getProfileByExtensionAbility_2300] getApplicationInfo callback data is: ' + JSON.stringify(data));
console.info('[getProfileByExtensionNotSuffixCall] getApplicationInfo callback data is: ' + JSON.stringify(data));
expect(Array.isArray(data)).assertTrue();
expect(typeof data[0]).assertEqual("string");
done();
......@@ -416,34 +416,34 @@ export default function getProfileByExtensionAbility() {
})
/*
* @tc.number: getProfileByExtensionAbility_2400
* @tc.name: getProfileByExtensionAbility : The profile is obtained by specified ability
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0008
* @tc.name: getProfileByExtensionNoJsonPro
* @tc.desc: profile is invalid json format (by promise)
* @tc.level 0
*/
it('getProfileByExtensionAbility_2400', 0, async function (done) {
it('getProfileByExtensionNoJsonPro', 0, async function (done) {
await bundle.getProfileByExtensionAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME4).then(data => {
console.info('[getProfileByExtensionAbility_2400] data is: ' + JSON.stringify(data));
console.info('[getProfileByExtensionNoJsonPro] data is: ' + JSON.stringify(data));
expect().assertFail();
done();
}).catch(err => {
console.error('[getProfileByExtensionAbility_2400] Operation failed. Cause: ' + JSON.stringify(err));
console.error('[getProfileByExtensionNoJsonPro] Operation failed. Cause: ' + JSON.stringify(err));
expect(err).assertEqual(1);
done();
})
})
/*
* @tc.number: getProfileByExtensionAbility_2500
* @tc.name: getProfileByExtensionAbility : The profile is obtained by specified ability
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0046
* @tc.name: getProfileByExtensionNoJsonCall
* @tc.desc: profile is invalid json format (by callback)
* @tc.level 0
*/
it('getProfileByExtensionAbility_2500', 0, async function (done) {
it('getProfileByExtensionNoJsonCall', 0, async function (done) {
bundle.getProfileByExtensionAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME4, (err, data) => {
console.info('[getProfileByExtensionAbility_2500] err: ' + JSON.stringify(err));
console.info('[getProfileByExtensionNoJsonCall] err: ' + JSON.stringify(err));
expect(err).assertEqual(1);
console.info('[getProfileByExtensionAbility_2500] data is: ' + JSON.stringify(data));
console.info('[getProfileByExtensionNoJsonCall] data is: ' + JSON.stringify(data));
expect(typeof data).assertEqual("string");
expect(data).assertEqual("GetProfile failed");
done();
......
......@@ -44,7 +44,7 @@
"type": "page",
"isVisible": "true",
"launchType": "standard",
"orientation": "followrecent",
"orientation": "followRecent",
"language": "C++"
}
],
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册