Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
00344986
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
00344986
编写于
3月 19, 2022
作者:
O
openharmony_ci
提交者:
Gitee
3月 19, 2022
浏览文件
操作
浏览文件
下载
差异文件
!2676 update actsabilitymanageretstest ets test
Merge pull request !2676 from dy/OpenHarmony-3.1-Release
上级
d35a19fd
70025852
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
139 addition
and
949 deletion
+139
-949
aafwk/aafwk_standard/ActsDataAbilityJsTest/entry/src/main/js/test/ActsDataAbilityJsTest.test.js
...Test/entry/src/main/js/test/ActsDataAbilityJsTest.test.js
+129
-0
aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/test/ContextJsunit.test.ets
...ntry/src/main/ets/MainAbility/test/ContextJsunit.test.ets
+9
-9
aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/test/DataAbility.test.ets
.../entry/src/main/ets/MainAbility/test/DataAbility.test.ets
+0
-818
aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/test/List.test.ets
...etstest/entry/src/main/ets/MainAbility/test/List.test.ets
+0
-2
aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/test/getHapModuleInfoJsunit.test.ets
...main/ets/MainAbility/test/getHapModuleInfoJsunit.test.ets
+1
-120
未找到文件。
aafwk/aafwk_standard/ActsDataAbilityJsTest/entry/src/main/js/test/ActsDataAbilityJsTest.test.js
浏览文件 @
00344986
...
@@ -718,4 +718,133 @@ it('ACTS_ARelease_0100', 0, async function (done) {
...
@@ -718,4 +718,133 @@ it('ACTS_ARelease_0100', 0, async function (done) {
}
}
})
})
/*
* @tc.number: ACTS_Call_0100
* @tc.name: call : Inserts a single data record into the database.
* @tc.desc: Check the return value of the interface (by promise)
* @tc.level 0
*/
it
(
"
ACTS_Call_0100
"
,
0
,
async
function
(
done
)
{
console
.
log
(
'
ACTS_Call_0100 start......
'
);
var
pacMap
=
{
'
group_name
'
:
'
test1
'
,
'
ringtone_modify_time
'
:
28
};
var
rDAHelper
try
{
rDAHelper
=
featureAbility
.
acquireDataAbilityHelper
(
dataAbilityUri
);
console
.
debug
(
'
ACTS_AbeforeAll rDAHelper ====>:
'
+
rDAHelper
+
"
,JSON.
"
+
JSON
.
stringify
(
rDAHelper
));
expect
(
typeof
(
rDAHelper
)).
assertEqual
(
"
object
"
);
pacMap
.
group_name
=
'
test2
'
;
rDAHelper
.
call
(
dataAbilityUri
,
'
insert
'
,
''
,
pacMap
).
then
((
data
)
=>
{
console
.
info
(
'
ACTS_Call_0100 succeeded data:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
error
)
=>
{
console
.
error
(
'
ACTS_Call_0100 error:
'
+
JSON
.
stringify
(
error
));
});
done
();
}
catch
(
err
)
{
console
.
error
(
'
ACTS_Call_0100 catch(err)====>:
'
+
err
);
console
.
log
(
'
ACTS_Call_0100====<end catch(err)
'
);
done
();
}
console
.
log
(
'
ACTS_Call_0100 end......
'
);
})
/*
* @tc.number: ACTS_Call_0200
* @tc.name: call : Queries data in the database.
* @tc.desc: Check the return value of the interface
* @tc.level 0
*/
it
(
"
ACTS_Call_0200
"
,
0
,
async
function
(
done
)
{
console
.
log
(
'
ACTS_Call_0200 start......
'
);
var
arg
=
"
{
\"
equalTo
\"
:
\"
group_name
\"
}
"
;
var
pacMap
=
{
"
group_name
"
:
"
test1
"
,
"
columns
"
:
"
group_name,ringtone_modify_time
"
};
var
rDAHelper
try
{
rDAHelper
=
featureAbility
.
acquireDataAbilityHelper
(
dataAbilityUri
);
console
.
debug
(
'
ACTS_AbeforeAll rDAHelper ====>:
'
+
rDAHelper
+
"
,JSON.
"
+
JSON
.
stringify
(
rDAHelper
));
rDAHelper
.
call
(
dataAbilityUri
,
'
query
'
,
arg
,
pacMap
,
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
error
(
'
ACTS_Call_0200 error:
'
+
JSON
.
stringify
(
err
));
}
else
{
console
.
info
(
'
ACTS_Call_0200 succeeded:
'
+
JSON
.
stringify
(
data
));
}
});
}
catch
(
err
)
{
console
.
error
(
'
ACTS_Call_0200 catch(err)====>:
'
+
err
);
console
.
log
(
'
ACTS_Call_0200====<end catch(err)
'
);
done
();
}
console
.
log
(
'
ACTS_Call_0200 end......
'
);
})
/*
* @tc.number: ACTS_Call_0300
* @tc.name: call : Updates data records in the database.
* @tc.desc: Check the return value of the interface
* @tc.level 0
*/
it
(
"
ACTS_Call_0300
"
,
0
,
async
function
(
done
)
{
console
.
log
(
'
ACTS_Call_0300 start......
'
);
var
arg
=
"
{
\"
equalTo
\"
:
\"
ringtone_modify_time
\"
}
"
;
var
pacMap
=
{
'
ringtone_modify_time
'
:
28
,
'
group_name
'
:
'
testupdata1
'
};
var
rDAHelper
try
{
rDAHelper
=
featureAbility
.
acquireDataAbilityHelper
(
dataAbilityUri
);
console
.
debug
(
'
ACTS_AbeforeAll rDAHelper ====>:
'
+
rDAHelper
+
"
,JSON.
"
+
JSON
.
stringify
(
rDAHelper
));
rDAHelper
.
call
(
dataAbilityUri
,
'
update
'
,
arg
,
pacMap
,
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
error
(
'
ACTS_Call_0300 error:
'
+
JSON
.
stringify
(
err
));
}
else
{
console
.
info
(
'
ACTS_Call_0300 succeeded:
'
+
JSON
.
stringify
(
data
));
}
});
}
catch
(
err
)
{
console
.
error
(
'
ACTS_Call_0300 catch(err)====>:
'
+
err
);
console
.
log
(
'
ACTS_Call_0300====<end catch(err)
'
);
done
();
}
console
.
log
(
'
ACTS_Call_0300 end......
'
);
})
/*
* @tc.number: ACTS_Call_0400
* @tc.name: call : Deletes one or more data records from the database.
* @tc.desc: Check the return value of the interface
* @tc.level 0
*/
it
(
"
ACTS_Call_0400
"
,
0
,
async
function
(
done
)
{
console
.
log
(
'
ACTS_Call_0400 start......
'
);
var
arg
=
"
{
\"
lessThan
\"
:
\"
ringtone_modify_time
\"
}
"
;
var
pacMap
=
{
'
ringtone_modify_time
'
:
32
,
};
var
rDAHelper
try
{
rDAHelper
=
featureAbility
.
acquireDataAbilityHelper
(
dataAbilityUri
);
console
.
debug
(
'
ACTS_AbeforeAll rDAHelper ====>:
'
+
rDAHelper
+
"
,JSON.
"
+
JSON
.
stringify
(
rDAHelper
));
rDAHelper
.
call
(
dataAbilityUri
,
'
delete
'
,
arg
,
pacMap
,
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
error
(
'
ACTS_Call_0400 error:
'
+
JSON
.
stringify
(
err
));
}
else
{
console
.
info
(
'
ACTS_Call_0400 succeeded:
'
+
JSON
.
stringify
(
data
));
}
});
done
();
}
catch
(
err
)
{
console
.
error
(
'
ACTS_Call_0400 catch(err)====>:
'
+
err
);
console
.
log
(
'
ACTS_Call_0400====<end catch(err)
'
);
done
();
}
console
.
log
(
'
ACTS_Call_0400 end......
'
);
})
})
})
\ No newline at end of file
aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/test/ContextJsunit.test.ets
浏览文件 @
00344986
...
@@ -17,7 +17,7 @@ import featureAbility from '@ohos.ability.featureAbility'
...
@@ -17,7 +17,7 @@ import featureAbility from '@ohos.ability.featureAbility'
import {describe, beforeEach, afterEach, it, expect} from "deccjsunit/index.ets";
import {describe, beforeEach, afterEach, it, expect} from "deccjsunit/index.ets";
import Utils from './Utils';
import Utils from './Utils';
export default function
c
ontextJsunit() {
export default function
C
ontextJsunit() {
describe('appInfoTest', function () {
describe('appInfoTest', function () {
beforeEach(async function (done) {
beforeEach(async function (done) {
console.info("context before each called");
console.info("context before each called");
...
@@ -47,11 +47,11 @@ export default function contextJsunit() {
...
@@ -47,11 +47,11 @@ export default function contextJsunit() {
})
})
} catch (error) {
} catch (error) {
console.log("logMessage context_getCacheDir_test_0100: error = " + error);
console.log("logMessage context_getCacheDir_test_0100: error = " + error);
expect(error).assertEqual("/data/
accounts/account_0/appdata/com.ohos.acecollaboration/cache
");
expect(error).assertEqual("/data/
storage/el2/base/haps/entry/caches
");
}
}
var data1 = await context.getCacheDir();
var data1 = await context.getCacheDir();
expect(typeof (data1)).assertEqual("string");
expect(typeof (data1)).assertEqual("string");
expect(data1).assertEqual("/data/
accounts/account_0/appdata/com.ohos.acecollaboration/cache
");
expect(data1).assertEqual("/data/
storage/el2/base/haps/entry/caches
");
done();
done();
console.log("------------------end context_getCacheDir_test_0100-------------------");
console.log("------------------end context_getCacheDir_test_0100-------------------");
});
});
...
@@ -74,11 +74,11 @@ export default function contextJsunit() {
...
@@ -74,11 +74,11 @@ export default function contextJsunit() {
});
});
} catch (error) {
} catch (error) {
console.log("logMessage context_getCacheDir_test_0200: error = " + error);
console.log("logMessage context_getCacheDir_test_0200: error = " + error);
expect(error).assertEqual("/data/
accounts/account_0/appdata/com.ohos.acecollaboration/cache
");
expect(error).assertEqual("/data/
storage/el2/base/haps/entry/caches
");
}
}
var data1 = await context.getCacheDir();
var data1 = await context.getCacheDir();
expect(typeof (data1)).assertEqual("string");
expect(typeof (data1)).assertEqual("string");
expect(data1).assertEqual("/data/
accounts/account_0/appdata/com.ohos.acecollaboration/cache
");
expect(data1).assertEqual("/data/
storage/el2/base/haps/entry/caches
");
done();
done();
console.log("------------------end context_getCacheDir_test_0200-------------------");
console.log("------------------end context_getCacheDir_test_0200-------------------");
});
});
...
@@ -101,11 +101,11 @@ export default function contextJsunit() {
...
@@ -101,11 +101,11 @@ export default function contextJsunit() {
})
})
} catch (error) {
} catch (error) {
console.log("logMessage context_getFilesDir_test_0100: error = " + error);
console.log("logMessage context_getFilesDir_test_0100: error = " + error);
expect(error).assertEqual("/data/
accounts/account_0/appdata/com.ohos.acecollaboration
/files");
expect(error).assertEqual("/data/
storage/el2/base/haps/entry
/files");
}
}
var data1 = await context.getFilesDir();
var data1 = await context.getFilesDir();
expect(typeof (data1)).assertEqual("string");
expect(typeof (data1)).assertEqual("string");
expect(data1).assertEqual("/data/
accounts/account_0/appdata/com.ohos.acecollaboration
/files");
expect(data1).assertEqual("/data/
storage/el2/base/haps/entry
/files");
done();
done();
console.log("------------------end context_getFilesDir_test_0100-------------------");
console.log("------------------end context_getFilesDir_test_0100-------------------");
});
});
...
@@ -128,11 +128,11 @@ export default function contextJsunit() {
...
@@ -128,11 +128,11 @@ export default function contextJsunit() {
});
});
} catch (error) {
} catch (error) {
console.log("logMessage context_getFilesDir_test_0200: error = " + error);
console.log("logMessage context_getFilesDir_test_0200: error = " + error);
expect(error).assertEqual("/data/
accounts/account_0/appdata/com.ohos.acecollaboration
/files");
expect(error).assertEqual("/data/
storage/el2/base/haps/entry
/files");
}
}
var data1 = await context.getFilesDir();
var data1 = await context.getFilesDir();
expect(typeof (data1)).assertEqual("string");
expect(typeof (data1)).assertEqual("string");
expect(data1).assertEqual("/data/
accounts/account_0/appdata/com.ohos.acecollaboration
/files");
expect(data1).assertEqual("/data/
storage/el2/base/haps/entry
/files");
done();
done();
console.log("------------------end context_getFilesDir_test_0200-------------------");
console.log("------------------end context_getFilesDir_test_0200-------------------");
});
});
...
...
aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/test/DataAbility.test.ets
已删除
100644 → 0
浏览文件 @
d35a19fd
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import featureAbility from '@ohos.ability.featureAbility'
import {describe, expect, it} from 'deccjsunit/index.ets'
const URI_CONTACTS = 'dataability:///com.ohos.contactsdataability';
const contactUri = 'dataability:///com.ohos.contactsdataability/contacts/groups';
const contactUri2 = 'dataability:///com.ohos.contactsdataability/contacts/groups2';
import Utils from './Utils';
const INSERT_ONE = 'dataAbility_insert_test ';
const QUERY_TWO = 'dataAbility_query_test ';
const UPDATE_THREE = 'dataAbility_update_test ';
const DELETE_FOUR = 'dataAbility_delete_test ';
export default function DataAbilityJsunit() {
var dataAbilityHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS);
var pacMap = {
'group_name': 'test1',
'ringtone_modify_time': 28
};
var pacMap_3 = {
'group_name': 'test3',
'ringtone_modify_time': 20
};
var pacMap_4 = {
'group_name': 'test4',
'ringtone_modify_time': 40
};
describe('appInfoTest', function () {
/*
* @tc.number: dataAbility_insert_test_001
* @tc.name: call : Inserts a single data record into the database.
* @tc.desc: Check the return value of the interface (by AsyncCallback)
* @tc.level 0
*/
it(INSERT_ONE + '001', 0, async function (done) {
let details;
let wrong;
console.log(INSERT_ONE + '001 start......');
var timeOldStamp = await Utils.getNowTime();
dataAbilityHelper.call(contactUri, 'insert', '', pacMap, (err, data) => {
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime(INSERT_ONE + '001', timeOldStamp, timeNewStamp);
if (err) {
wrong = err;
console.error(INSERT_ONE + '001 error: ' + JSON.stringify(err));
} else {
details = data;
console.info(INSERT_ONE + '001 succeeded data: ' + JSON.stringify(data));
}
});
await Utils.sleep(1000);
details != null ? expectDetails(details, true, 1) : expectDetails(wrong, true, 2);
done();
console.log(INSERT_ONE + '001 end ......');
});
/*
* @tc.number: dataAbility_insert_test_002
* @tc.name: call : Inserts a single data record into the database.
* @tc.desc: Check the return value of the interface (by promise)
* @tc.level 0
*/
it(INSERT_ONE + '002', 0, async function (done) {
let details;
let wrong;
console.log(INSERT_ONE + '002 start......');
pacMap.group_name = 'test2';
var timeOldStamp = await Utils.getNowTime();
dataAbilityHelper.call(contactUri, 'insert', '', pacMap).then((data) => {
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime(INSERT_ONE + '002', timeOldStamp, timeNewStamp);
details = data;
console.info(INSERT_ONE + '002 succeeded data: ' + JSON.stringify(data));
}).catch((error) => {
wrong = error;
console.error(INSERT_ONE + '002 error: ' + JSON.stringify(error));
});
await Utils.sleep(1000);
details != null ? expectDetails(details, true, 1) : expectDetails(wrong, true, 2);
done();
console.log(INSERT_ONE + '002 end......');
});
/*
* @tc.number: dataAbility_insert_test_003
* @tc.name: call : Inserts a incorrect uri data record into the database.
* @tc.desc: Check the return value of the interface
* @tc.level 0
*/
it(INSERT_ONE + '003', 0, async function (done) {
let details;
let wrong;
console.log(INSERT_ONE + '003 start......');
dataAbilityHelper.call(contactUri2, 'insert', '', pacMap).then((data) => {
details = data
console.info(INSERT_ONE + '003 succeeded: ' + JSON.stringify(data));
}).catch((error) => {
wrong = error;
console.error(INSERT_ONE + '003 error: ' + JSON.stringify(error));
});
await Utils.sleep(1000);
details != null ? expectDetails(details, true, 1) : expectDetails(wrong, true, 2);
done();
console.log(INSERT_ONE + '003 end......');
});
/*
* @tc.number: dataAbility_insert_test_004
* @tc.name: call : Inserts a null uri data record into the database.
* @tc.desc: Check the return value of the interface
* @tc.level 0
*/
it(INSERT_ONE + '004', 0, async function (done) {
let details;
let wrong;
console.log(INSERT_ONE + '004 start......');
dataAbilityHelper.call('', 'insert', '', pacMap).then((data) => {
details = data;
console.info(INSERT_ONE + '004 succeeded: ' + JSON.stringify(data));
}).catch((error) => {
wrong = error;
console.error(INSERT_ONE + '004 error: ' + JSON.stringify(error));
});
await Utils.sleep(1000);
details != null ? expectDetails(details, true, 1) : expectDetails(wrong, true, 2);
done();
console.log(INSERT_ONE + '004 end......');
});
/*
* @tc.number: dataAbility_insert_test_005
* @tc.name: call : Inserts a null methold data record into the database.
* @tc.desc: Check the return value of the interface
* @tc.level 0
*/
it(INSERT_ONE + '005', 0, async function (done) {
let details;
let wrong;
console.log(INSERT_ONE + '005 start......');
let pacMap = {
'group_name': 'test4',
'ringtone_modify_time': 28
};
dataAbilityHelper.call(contactUri, "", "", pacMap).then((data) => {
details = data;
console.info(INSERT_ONE + '005 succeeded: ' + JSON.stringify(data));
}).catch((error) => {
wrong = error;
console.error(INSERT_ONE + '005 error: ' + JSON.stringify(error));
});
await Utils.sleep(1000);
details != null ? expectDetails(details, true, 1) : expectDetails(wrong, true, 2);
done();
console.log(INSERT_ONE + '005 end......');
});
/*
* @tc.number: dataAbility_query_test_001
* @tc.name: call : Queries data in the database.
* @tc.desc: Check the return value of the interface
* @tc.level 0
*/
it(QUERY_TWO + '001', 0, async function (done) {
let details;
let wrong;
console.log(QUERY_TWO + '001 start......');
let arg = "{\"equalTo\": \"group_name\"}";
let pacMap = {
"group_name": "test1",
"columns": "group_name,ringtone_modify_time"
};
var timeOldStamp = await Utils.getNowTime();
dataAbilityHelper.call(contactUri, 'query', arg, pacMap, (err, data) => {
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime(QUERY_TWO + '001', timeOldStamp, timeNewStamp);
wrong = err;
if (wrong) {
console.error(QUERY_TWO + '001 error: ' + JSON.stringify(wrong));
} else {
details = data;
console.info(QUERY_TWO + '001 succeeded: ' + JSON.stringify(data));
}
});
await Utils.sleep(1000);
details != null ? expectDetails(details, false, 4) : expectDetails(wrong, true, 2);
done();
console.log(QUERY_TWO + '001 end......');
});
/*
* @tc.number: dataAbility_query_test_002
* @tc.name: call : Queries data in the database.
* @tc.desc: Check the return value of the interface
* @tc.level 0
*/
it(QUERY_TWO + '002', 0, async function (done) {
let details;
let wrong;
console.log(QUERY_TWO + '002 start......');
let arg = "{\"between\": \"ringtone_modify_time\"}";
let pacMap = {
'ringtone_modify_time': "15, 30",
"columns": "group_name,ringtone_modify_time"
};
var timeOldStamp = await Utils.getNowTime();
dataAbilityHelper.call(contactUri, 'query', arg, pacMap, (err, data) => {
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime(QUERY_TWO + '002', timeOldStamp, timeNewStamp);
wrong = err;
if (wrong) {
console.error(QUERY_TWO + '002 error: ' + JSON.stringify(wrong));
} else {
details = data;
console.info(QUERY_TWO + '002 succeeded: ' + JSON.stringify(data));
}
});
await Utils.sleep(1000);
details != null ? expectDetails(details, false, 4) : expectDetails(wrong, true, 2);
done();
console.log(QUERY_TWO + '002 end......');
});
/*
* @tc.number: dataAbility_query_test_003
* @tc.name: call : Queries data in the database.
* @tc.desc: Check the return value of the interface
* @tc.level 0
*/
it(QUERY_TWO + '003', 0, async function (done) {
let details;
let wrong;
console.log(QUERY_TWO + '003 start......');
let arg = {
'like': 'group_name'
};
let pacMap = {
'group_name': '%test%',
'columns': 'group_name,ringtone_modify_time'
};
var timeOldStamp = await Utils.getNowTime();
dataAbilityHelper.call(contactUri, 'query', arg, pacMap, (err, data) => {
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime(QUERY_TWO + '003', timeOldStamp, timeNewStamp);
wrong = err;
if (wrong) {
console.error(QUERY_TWO + '003 error: ' + JSON.stringify(wrong));
} else {
details = data;
console.info(QUERY_TWO + '003 succeeded: ' + JSON.stringify(data));
}
});
await Utils.sleep(1000);
details != null ? expectDetails(details, false, 4) : expectDetails(wrong, true, 2);
done();
console.log(QUERY_TWO + '003 end......');
});
/*
* @tc.number: dataAbility_query_test_004
* @tc.name: call : Queries data in the database.
* @tc.desc: Check the return value of the interface
* @tc.level 0
*/
it(QUERY_TWO + '004', 0, async function (done) {
let details;
let wrong;
console.log(QUERY_TWO + '004 start......');
let arg = {
'greaterThanOrEqualTo': 'ringtone_modify_time'
};
let pacMap = {
'ringtone_modify_time': 20,
'columns': 'group_name,ringtone_modify_time'
};
var timeOldStamp = await Utils.getNowTime();
dataAbilityHelper.call(contactUri, 'query', arg, pacMap, (err, data) => {
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime(QUERY_TWO + '004', timeOldStamp, timeNewStamp);
if (err) {
wrong = err;
console.error(QUERY_TWO + '004 error: ' + JSON.stringify(err));
return;
} else {
details = data;
console.info(QUERY_TWO + '004 succeeded: ' + JSON.stringify(data));
}
});
await Utils.sleep(1000);
details != null ? expectDetails(details, false, 4) : expectDetails(wrong, true, 2);
done();
console.log(QUERY_TWO + '004 end......');
});
/*
* @tc.number: dataAbility_query_test_005
* @tc.name: call : Queries abnormal data in the database.
* @tc.desc: Check the return value of the interface
* @tc.level 0
*/
it(QUERY_TWO + '005', 0, async function (done) {
let details;
let wrong;
let pacMap = {
'ringtone_modify_time': 20,
'columns': 'group_name,ringtone_modify_time'
};
console.log(INSERT_ONE + '003 start......');
dataAbilityHelper.call(contactUri2, 'query', '', pacMap).then((data) => {
details = data
console.info(QUERY_TWO + '005 succeeded: ' + JSON.stringify(data));
}).catch((error) => {
wrong = error;
console.error(QUERY_TWO + '005 error: ' + JSON.stringify(error));
});
await Utils.sleep(1000);
details != null ? expectDetails(details, false, 4) : expectDetails(wrong, true, 2);
done();
console.log(QUERY_TWO + '005 end......');
});
/*
* @tc.number: dataAbility_query_test_006
* @tc.name: call : Queries abnormal data in the database.
* @tc.desc: Check the return value of the interface
* @tc.level 0
*/
it(QUERY_TWO + '006', 0, async function (done) {
let details;
let wrong;
let pacMap = {
'ringtone_modify_time': 20,
'columns': 'group_name,ringtone_modify_time'
};
console.log(QUERY_TWO + '004 start......');
dataAbilityHelper.call('', 'query', '', pacMap).then((data) => {
details = data;
console.info(QUERY_TWO + '006 succeeded: ' + JSON.stringify(data));
}).catch((error) => {
wrong = error;
console.error(QUERY_TWO + '006 error: ' + JSON.stringify(error));
});
await Utils.sleep(1000);
details != null ? expectDetails(details, false, 4) : expectDetails(wrong, true, 2);
done();
console.log(QUERY_TWO + '006 end......');
});
/*
* @tc.number: dataAbility_update_test_001
* @tc.name: call : Updates data records in the database.
* @tc.desc: Check the return value of the interface
* @tc.level 0
*/
it(UPDATE_THREE + '001', 0, async function (done) {
let details;
let wrong;
console.log(UPDATE_THREE + '001 start......');
let arg = "{\"equalTo\": \"ringtone_modify_time\"}";
let pacMap = {
'ringtone_modify_time': 28,
'group_name': 'testupdata1'
};
var timeOldStamp = await Utils.getNowTime();
dataAbilityHelper.call(contactUri, 'update', arg, pacMap, (err, data) => {
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime(UPDATE_THREE + '001', timeOldStamp, timeNewStamp);
if (err) {
wrong = err;
console.error(UPDATE_THREE + '001 error: ' + JSON.stringify(err));
} else {
details = data;
console.info(UPDATE_THREE + '001 succeeded: ' + JSON.stringify(data));
}
});
await Utils.sleep(1000);
details != null ? expectDetails(details, true, 3) : expectDetails(wrong, true, 2);
done();
console.log(UPDATE_THREE + '001 end......');
});
/*
* @tc.number: dataAbility_update_test_002
* @tc.name: call : Updates data records in the database.
* @tc.desc: Check the return value of the interface
* @tc.level 0
*/
it(UPDATE_THREE + '002', 0, async function (done) {
let details;
let wrong;
console.log(UPDATE_THREE + '002 start......');
let arg = "{\"between\": \"ringtone_modify_time\"}";
let pacMap = {
'ringtone_modify_time': "15, 30",
'group_name': 'testupdata2'
};
var timeOldStamp = await Utils.getNowTime();
dataAbilityHelper.call(contactUri, 'update', arg, pacMap, (err, data) => {
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime(UPDATE_THREE + '002', timeOldStamp, timeNewStamp);
if (err) {
wrong = err;
console.error(UPDATE_THREE + '002 error: ' + JSON.stringify(err));
} else {
details = data;
console.info(UPDATE_THREE + '002 succeeded: ' + JSON.stringify(data));
}
});
await Utils.sleep(1000);
details != null ? expectDetails(details, true, 3) : expectDetails(wrong, true, 2);
done();
console.log(UPDATE_THREE + '002 end......');
});
/*
* @tc.number: dataAbility_update_test_003
* @tc.name: call : Updates data records in the database.
* @tc.desc: Check the return value of the interface
* @tc.level 0
*/
it(UPDATE_THREE + '003', 0, async function (done) {
let details;
let wrong;
console.log(UPDATE_THREE + '003 start......');
let arg = {
'contains': 'group_name'
};
let pacMap = {
'group_name': 'ata2',
'ringtone_modify_time': 100
};
var timeOldStamp = await Utils.getNowTime();
dataAbilityHelper.call(contactUri, 'update', arg, pacMap, (err, data) => {
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime(UPDATE_THREE + '003', timeOldStamp, timeNewStamp);
if (err) {
wrong = err;
console.error(UPDATE_THREE + '003 error: ' + JSON.stringify(err));
} else {
details = data;
console.info(UPDATE_THREE + '003 succeeded: ' + JSON.stringify(data));
}
});
await Utils.sleep(1000);
details != null ? expectDetails(details, true, 3) : expectDetails(wrong, true, 2);
done();
console.log(UPDATE_THREE + '003 end......');
});
/*
* @tc.number: dataAbility_update_test_004
* @tc.name: call : Updates data records in the database.
* @tc.desc: Check the return value of the interface
* @tc.level 0
*/
it(UPDATE_THREE + '004', 0, async function (done) {
let details;
let wrong;
console.log(UPDATE_THREE + '004 start......');
let arg = {
'lessThan': 'ringtone_modify_time'
};
let pacMap = {
'ringtone_modify_time': 32,
'group_name': 'testupdata2'
};
var timeOldStamp = await Utils.getNowTime();
dataAbilityHelper.call(contactUri, 'update', arg, pacMap, (err, data) => {
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime(UPDATE_THREE + '004', timeOldStamp, timeNewStamp);
if (err) {
wrong = err;
console.error(UPDATE_THREE + '004 error: ' + JSON.stringify(err));
} else {
details = data;
console.info(UPDATE_THREE + '004 succeeded: ' + JSON.stringify(data));
}
});
await Utils.sleep(1000);
details != null ? expectDetails(details, true, 3) : expectDetails(wrong, true, 2);
done();
console.log(UPDATE_THREE + '004 end......');
});
/*
* @tc.number: dataAbility_update_test_005
* @tc.name: call : Updates abnormal data records in the database.
* @tc.desc: Check the return value of the interface
* @tc.level 0
*/
it(UPDATE_THREE + '005', 0, async function (done) {
let details;
let wrong;
console.log(UPDATE_THREE + '005 start......');
let pacMap = {
'ringtone_modify_time': 32,
'group_name': 'testupdata2'
};
var timeOldStamp = await Utils.getNowTime();
dataAbilityHelper.call(contactUri2, 'update', '', pacMap, (err, data) => {
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime(UPDATE_THREE + '005', timeOldStamp, timeNewStamp);
if (err) {
wrong = err;
console.error(UPDATE_THREE + '005 error: ' + JSON.stringify(err));
} else {
details = data;
console.info(UPDATE_THREE + '005 succeeded: ' + JSON.stringify(data));
}
});
await Utils.sleep(1000);
details != null ? expectDetails(details, true, 3) : expectDetails(wrong, true, 2);
done();
console.log(UPDATE_THREE + '005 end......');
});
/*
* @tc.number: dataAbility_update_test_006
* @tc.name: call : Updates abnormal data records in the database.
* @tc.desc: Check the return value of the interface
* @tc.level 0
*/
it(UPDATE_THREE + '006', 0, async function (done) {
let details;
let wrong;
console.log(UPDATE_THREE + '006 start......');
let pacMap = {
'ringtone_modify_time': 32,
'group_name': 'testupdata2'
};
var timeOldStamp = await Utils.getNowTime();
dataAbilityHelper.call('', 'update', '', pacMap, (err, data) => {
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime(UPDATE_THREE + '006', timeOldStamp, timeNewStamp);
if (err) {
wrong = err;
console.error(UPDATE_THREE + '006 error: ' + JSON.stringify(err));
} else {
details = data;
console.info(UPDATE_THREE + '006 succeeded: ' + JSON.stringify(data));
}
});
await Utils.sleep(1000);
details != null ? expectDetails(details, true, 3) : expectDetails(wrong, true, 2);
done();
console.log(UPDATE_THREE + '006 end......');
});
/*
* @tc.number: dataAbility_delete_test_001
* @tc.name: call : Deletes one or more data records from the database.
* @tc.desc: Check the return value of the interface
* @tc.level 0
*/
dataAbilityHelper.call(contactUri, 'insert', '', pacMap, (err, data) => {
if (err) {
console.error('Operation failed1. Cause: ' + JSON.stringify(err));
return;
}
console.info('Operation succeeded1: ' + JSON.stringify(data));
});
it(DELETE_FOUR + '001', 0, async function (done) {
let details;
let wrong;
console.log(DELETE_FOUR + '001 start......');
let arg2 = "{\"equalTo\": \"group_name\"}";
let pacMap2 = {
'group_name': 'test1'
};
var timeOldStamp = await Utils.getNowTime();
dataAbilityHelper.call(contactUri, 'delete', arg2, pacMap2, (err2, data2) => {
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime(DELETE_FOUR + '001', timeOldStamp, timeNewStamp);
if (err2) {
wrong = err2;
console.error(DELETE_FOUR + '001 error: ' + JSON.stringify(err2));
} else {
details = data2;
console.info(DELETE_FOUR + '001 succeeded: ' + JSON.stringify(data2));
}
});
await Utils.sleep(1000);
details != null ? expectDetails(details, true, 3) : expectDetails(wrong, true, 2);
done();
console.log(DELETE_FOUR + '001 end......');
});
/*
* @tc.number: dataAbility_delete_test_002
* @tc.name: call : Deletes one or more data records from the database.
* @tc.desc: Check the return value of the interface
* @tc.level 0
*/
it(DELETE_FOUR + '002', 0, async function (done) {
let details;
let wrong
console.log(DELETE_FOUR + '002 start......');
let arg = "{\"lessThan\": \"ringtone_modify_time\"}";
let pacMap = {
'ringtone_modify_time': 32,
};
var timeOldStamp = await Utils.getNowTime();
dataAbilityHelper.call(contactUri, 'delete', arg, pacMap, (err, data) => {
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime(DELETE_FOUR + '002', timeOldStamp, timeNewStamp);
if (err) {
wrong = err;
console.error(DELETE_FOUR + '002 error: ' + JSON.stringify(err));
} else {
details = data;
console.info(DELETE_FOUR + '002 succeeded: ' + JSON.stringify(data));
}
});
await Utils.sleep(1000);
details != null ? expectDetails(details, true, 3) : expectDetails(wrong, true, 2);
done();
console.log(DELETE_FOUR + '002 end......');
});
/*
* @tc.number: dataAbility_delete_test_003
* @tc.name: call : Deletes one or more data records from the database.
* @tc.desc: Check the return value of the interface
* @tc.level 0
*/
dataAbilityHelper.call(contactUri, 'insert', '', pacMap_3, (err, data) => {
if (err) {
console.error('Operation failed3. Cause: ' + JSON.stringify(err));
return;
}
console.info('Operation succeeded3: ' + JSON.stringify(data));
});
it(DELETE_FOUR + '003', 0, async function (done) {
let details;
let wrong;
console.log(DELETE_FOUR + '003 start......');
let arg2 = {
'like': 'group_name'
};
let pacMap2 = {
'group_name': '%test%'
};
var timeOldStamp = await Utils.getNowTime();
dataAbilityHelper.call(contactUri, 'delete', arg2, pacMap2, (err2, data2) => {
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime(DELETE_FOUR + '003', timeOldStamp, timeNewStamp);
if (err2) {
wrong = err2;
console.error(DELETE_FOUR + '003 error: ' + JSON.stringify(err2));
} else {
details = data2;
console.info(DELETE_FOUR + '003 delete succeeded: ' + JSON.stringify(data2));
}
});
await Utils.sleep(1000);
details != null ? expectDetails(details, true, 3) : expectDetails(wrong, true, 2);
done();
console.log(DELETE_FOUR + '003 delete end......');
});
/*
* @tc.number: dataAbility_delete_test_004
* @tc.name: call : Deletes one or more data records from the database.
* @tc.desc: Check the return value of the interface
* @tc.level 0
*/
dataAbilityHelper.call(contactUri, 'insert', '', pacMap_4, (err, data) => {
if (err) {
console.error('Operation failed4. Cause: ' + JSON.stringify(err));
return;
}
console.info('Operation succeeded4: ' + JSON.stringify(data));
});
it(DELETE_FOUR + '004', 0, async function (done) {
let details;
let wrong;
console.log(DELETE_FOUR + '004 start......');
let arg2 = {
'greaterThanOrEqualTo': 'ringtone_modify_time'
};
let pacMap2 = {
'ringtone_modify_time': 40
};
var timeOldStamp = await Utils.getNowTime();
dataAbilityHelper.call(contactUri, 'delete', arg2, pacMap2, (err2, data2) => {
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime(DELETE_FOUR + '004', timeOldStamp, timeNewStamp);
if (err2) {
wrong = err2;
console.error(DELETE_FOUR + '004 error: ' + JSON.stringify(err2));
} else {
details = data2;
console.info(DELETE_FOUR + '004 delete succeeded: ' + JSON.stringify(data2));
}
});
await Utils.sleep(1000);
details != null ? expectDetails(details, true, 3) : expectDetails(wrong, true, 2);
done();
console.log(DELETE_FOUR + '004 delete end......');
});
/*
* @tc.number: dataAbility_delete_test_005
* @tc.name: call : Deletes abnormal data records from the database.
* @tc.desc: Check the return value of the interface
* @tc.level 0
*/
dataAbilityHelper.call(contactUri, 'insert', '', pacMap_4, (err, data) => {
if (err) {
console.error('Operation failed4. Cause: ' + JSON.stringify(err));
return;
}
console.info('Operation succeeded5: ' + JSON.stringify(data));
});
it(DELETE_FOUR + '005', 0, async function (done) {
let details;
let wrong;
console.log(DELETE_FOUR + '005 start......');
let pacMap2 = {
'ringtone_modify_time': 40
};
var timeOldStamp = await Utils.getNowTime();
dataAbilityHelper.call(contactUri2, 'delete', '', pacMap2, (err2, data2) => {
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime(DELETE_FOUR + '005', timeOldStamp, timeNewStamp);
if (err2) {
wrong = err2;
console.error(DELETE_FOUR + '005 error: ' + JSON.stringify(err2));
} else {
details = data2;
console.info(DELETE_FOUR + '005 delete succeeded: ' + JSON.stringify(data2));
}
});
await Utils.sleep(1000);
details != null ? expectDetails(details, true, 3) : expectDetails(wrong, true, 2);
done();
console.log(DELETE_FOUR + '005 delete end......');
});
/*
* @tc.number: dataAbility_delete_test_006
* @tc.name: call : Deletes abnormal data records from the database.
* @tc.desc: Check the return value of the interface
* @tc.level 0
*/
dataAbilityHelper.call(contactUri, 'insert', '', pacMap_4, (err, data) => {
if (err) {
console.error('Operation failed4. Cause: ' + JSON.stringify(err));
return;
}
console.info('Operation succeeded4: ' + JSON.stringify(data));
});
it(DELETE_FOUR + '006', 0, async function (done) {
let details;
let wrong;
console.log(DELETE_FOUR + '006 start......');
let pacMap2 = {
'ringtone_modify_time': 40
};
var timeOldStamp = await Utils.getNowTime();
dataAbilityHelper.call('', 'delete', '', pacMap2, (err2, data2) => {
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime(DELETE_FOUR + '006', timeOldStamp, timeNewStamp);
if (err2) {
wrong = err2;
console.error(DELETE_FOUR + '006 error: ' + JSON.stringify(err2));
} else {
details = data2;
console.info(DELETE_FOUR + '006 delete succeeded: ' + JSON.stringify(data2));
}
});
await Utils.sleep(1000);
details != null ? expectDetails(details, true, 3) : expectDetails(wrong, true, 2);
done();
console.log(DELETE_FOUR + '006 delete end......');
});
})
function expectDetails(data, isTrue, keyStatus) {
if (data != -1) {
expect(typeof (data)).assertEqual("object");
expect(typeof (data.result)).assertEqual(isTrue ? 'number' : 'string');
}
switch (keyStatus) {
case 1:
expect(data.result > 0).assertTrue();
break
case 2:
expect(data == -1).assertTrue();
break
case 3:
expect(data.result).assertEqual(0);
break
}
}
}
\ No newline at end of file
aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/test/List.test.ets
浏览文件 @
00344986
...
@@ -19,11 +19,9 @@ import getAbilityInfoJsunit from './getAbilityInfoJsunit.test.ets';
...
@@ -19,11 +19,9 @@ import getAbilityInfoJsunit from './getAbilityInfoJsunit.test.ets';
import getApplicationContext from './getApplicationContextJsunit.test.ets';
import getApplicationContext from './getApplicationContextJsunit.test.ets';
import getAppVersionInfoJsunit from './getAppVersionInfoJsunit.test.ets';
import getAppVersionInfoJsunit from './getAppVersionInfoJsunit.test.ets';
import ContextJsunit from './ContextJsunit.test.ets';
import ContextJsunit from './ContextJsunit.test.ets';
import DataAbilityJsunit from './DataAbility.test.ets';
export default function testsuite() {
export default function testsuite() {
ContextJsunit();
ContextJsunit();
DataAbilityJsunit();
addContextAndAbilityJsunit();
addContextAndAbilityJsunit();
getHapModuleInfoJsunit();
getHapModuleInfoJsunit();
getAbilityInfoJsunit();
getAbilityInfoJsunit();
...
...
aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/test/getHapModuleInfoJsunit.test.ets
浏览文件 @
00344986
...
@@ -75,29 +75,6 @@ export default function getHapModuleInfoJsunit() {
...
@@ -75,29 +75,6 @@ export default function getHapModuleInfoJsunit() {
done();
done();
});
});
/**
* @tc.number: context_getHapModuleInfo_test_0300_1
* @tc.name: getHapModuleInfo:Obtains the HapModuleInfo object of the application.
* @tc.desc: Check the return value of the interface
* @tc.level 0
*/
it('context_getHapModuleInfo_test_0300_1', 0, async function (done) {
console.info('[context_getHapModuleInfo_test_0300_1] START');
var str = {
"want": {
"bundleName": "com.ohos.acecollaboration",
"abilityName": "com.example.myapplication1.MainAbility",
},
};
ability_featureAbility.startAbility(str)
.then((data) => {
console.info('[context_getHapModuleInfo_test_0300_1] start myapplication1 successful: ' + JSON.stringify(data))
}).catch((error) => {
console.error('[context_getHapModuleInfo_test_0300_1] start myapplication1 Cause: ' + JSON.stringify(error));
})
done();
});
function checkHapModuleInfo(msg, data) {
function checkHapModuleInfo(msg, data) {
console.log(msg + "checkHapModuleInfo start " + JSON.stringify(data));
console.log(msg + "checkHapModuleInfo start " + JSON.stringify(data));
console.log(msg + "checkHapModuleInfo name : " + data.name);
console.log(msg + "checkHapModuleInfo name : " + data.name);
...
@@ -147,10 +124,7 @@ export default function getHapModuleInfoJsunit() {
...
@@ -147,10 +124,7 @@ export default function getHapModuleInfoJsunit() {
expect(data.backgroundImg).assertEqual("");
expect(data.backgroundImg).assertEqual("");
expect(data.supportedModes).assertEqual(0);
expect(data.supportedModes).assertEqual(0);
expect(data.deviceTypes[0]).assertEqual("phone");
expect(data.deviceTypes[0]).assertEqual("phone");
for (var i = 0; i < data.abilityInfos.length; i++) {
checkAbilityInfo(msg,data.abilityInfos[0]);
console.log(msg + "-------AbilityInfo data.abilityInfos[" + i + "] : START ------" );
checkAbilityInfo(msg,data.abilityInfos[i]);
}
expect(data.moduleName).assertEqual("entry")
expect(data.moduleName).assertEqual("entry")
expect(data.mainAbilityName).assertEqual("");
expect(data.mainAbilityName).assertEqual("");
expect(data.installationFree).assertEqual(false);
expect(data.installationFree).assertEqual(false);
...
@@ -233,8 +207,6 @@ export default function getHapModuleInfoJsunit() {
...
@@ -233,8 +207,6 @@ export default function getHapModuleInfoJsunit() {
expect(data.label).assertEqual("$string:entry_MainAbility");
expect(data.label).assertEqual("$string:entry_MainAbility");
expect(data.description).assertEqual("$string:mainability_description");
expect(data.description).assertEqual("$string:mainability_description");
expect(data.icon).assertEqual("$media:icon");
expect(data.icon).assertEqual("$media:icon");
expect(data.descriptionId > 0).assertTrue();
expect(data.iconId > 0).assertTrue();
expect(data.moduleName).assertEqual("entry");
expect(data.moduleName).assertEqual("entry");
expect(data.process).assertEqual("");
expect(data.process).assertEqual("");
expect(data.targetAbility).assertEqual("");
expect(data.targetAbility).assertEqual("");
...
@@ -247,106 +219,15 @@ export default function getHapModuleInfoJsunit() {
...
@@ -247,106 +219,15 @@ export default function getHapModuleInfoJsunit() {
expect(data.deviceTypes[0]).assertEqual("phone");
expect(data.deviceTypes[0]).assertEqual("phone");
expect(data.readPermission).assertEqual("");
expect(data.readPermission).assertEqual("");
expect(data.writePermission).assertEqual("");
expect(data.writePermission).assertEqual("");
checkApplicationInfo(msg,data.applicationInfo);
expect(data.formEntity).assertEqual(0);
expect(data.formEntity).assertEqual(0);
expect(data.minFormHeight).assertEqual(0);
expect(data.minFormHeight).assertEqual(0);
expect(data.defaultFormHeight).assertEqual(0);
expect(data.defaultFormHeight).assertEqual(0);
expect(data.minFormWidth).assertEqual(0);
expect(data.minFormWidth).assertEqual(0);
expect(data.defaultFormWidth).assertEqual(0);
expect(data.defaultFormWidth).assertEqual(0);
expect(data.uri).assertEqual("");
expect(data.uri).assertEqual("");
expect(data.labelId > 0).assertTrue();
expect(data.subType).assertEqual(0);
expect(data.subType).assertEqual(0);
console.log(msg+ "---checkAbilityInfo End--- ");
console.log(msg+ "---checkAbilityInfo End--- ");
}
}
function checkApplicationInfo(msg,info) {
console.log(msg+ "checkApplicationInfo start : " + JSON.stringify(info));
console.log(msg+ "checkApplicationInfo name : " + info.name);
console.log(msg+ "checkApplicationInfo description : " + info.description);
console.log(msg+ "checkApplicationInfo descriptionId : " + info.descriptionId);
console.log(msg+ "checkApplicationInfo systemApp : " + info.systemApp);
console.log(msg+ "checkApplicationInfo enabled : " + info.enabled);
console.log(msg+ "checkApplicationInfo label : " + info.label);
console.log(msg+ "checkApplicationInfo labelId : " + info.labelId);
console.log(msg+ "checkApplicationInfo icon : " + info.icon);
console.log(msg+ "checkApplicationInfo iconId : " + info.iconId);
console.log(msg+ "checkApplicationInfo process : " + info.process);
console.log(msg+ "checkApplicationInfo supportedModes : " + info.supportedModes);
console.log(msg+ "checkApplicationInfo moduleSourceDirs length : " + info.moduleSourceDirs.length);
for (var j = 0; j < info.moduleSourceDirs.length; j++) {
console.log(msg+ "checkApplicationInfo info.moduleSourceDirs[" + j + "] : " + info.moduleSourceDirs[j]);
}
console.log(msg+ "checkApplicationInfo permissions length : " + info.permissions.length);
for (var k = 0; k < info.permissions.length; k++) {
console.log(msg+ "checkApplicationInfo info.permissions[" + k + "] : " + info.permissions[k]);
}
console.log(msg+ "checkApplicationInfo moduleInfos length : " + info.moduleInfos.length);
for (var i = 0; i < info.moduleInfos.length; i++) {
console.log(msg+ "checkApplicationInfo info.moduleInfos[" + i + "].moduleName : " +
info.moduleInfos[i].moduleName);
console.log(msg+ "checkApplicationInfo info.moduleInfos[" + i + "].moduleSourceDir : " +
info.moduleInfos[i].moduleSourceDir);
}
console.log(msg+ "checkApplicationInfo entryDir : " + info.entryDir);
expect(typeof (info)).assertEqual("object");
expect(typeof (info.name)).assertEqual("string");
expect(typeof (info.description)).assertEqual("string");
expect(typeof (info.descriptionId)).assertEqual("number");
expect(typeof (info.systemApp)).assertEqual("boolean");
expect(typeof (info.enabled)).assertEqual("boolean");
expect(typeof (info.label)).assertEqual("string");
expect(typeof (info.labelId)).assertEqual("string");
expect(typeof (info.icon)).assertEqual("string");
expect(typeof (info.iconId)).assertEqual("string");
expect(typeof (info.process)).assertEqual("string");
expect(typeof (info.supportedModes)).assertEqual("number");
expect(Array.isArray(info.moduleSourceDirs)).assertEqual(true);
expect(Array.isArray(info.permissions)).assertEqual(true);
expect(Array.isArray(info.moduleInfos)).assertEqual(true);
expect(typeof (info.entryDir)).assertEqual("string");
if (info.moduleSourceDirs.length == 1){
expect(info.moduleInfos[0].moduleName).assertEqual("entry");
expect(info.moduleInfos[0].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" +
"com.ohos.acecollaboration/com.ohos.acecollaboration");
}else if(info.moduleSourceDirs.length == 2) {
if (info.moduleInfos[0].moduleName == "myapplication1") {
expect(info.moduleInfos[0].moduleName).assertEqual("myapplication1");
expect(info.moduleInfos[0].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" +
"com.ohos.acecollaboration/com.example.myapplication1");
expect(info.moduleInfos[1].moduleName).assertEqual("entry");
expect(info.moduleInfos[1].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" +
"com.ohos.acecollaboration/com.ohos.acecollaboration");
}else{
expect(info.moduleInfos[0].moduleName).assertEqual("myapplication2");
expect(info.moduleInfos[0].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" +
"com.ohos.acecollaboration/com.example.myapplication2");
expect(info.moduleInfos[1].moduleName).assertEqual("entry");
expect(info.moduleInfos[1].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" +
"com.ohos.acecollaboration/com.ohos.acecollaboration");
}
}else {
expect(info.moduleInfos[0].moduleName).assertEqual("myapplication1");
expect(info.moduleInfos[0].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" +
"com.ohos.acecollaboration/com.example.myapplication1");
expect(info.moduleInfos[1].moduleName).assertEqual("myapplication2");
expect(info.moduleInfos[1].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" +
"com.ohos.acecollaboration/com.example.myapplication2");
expect(info.moduleInfos[2].moduleName).assertEqual("entry");
expect(info.moduleInfos[2].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" +
"com.ohos.acecollaboration/com.ohos.acecollaboration");
}
expect(info.name).assertEqual("com.ohos.acecollaboration");
expect(info.description).assertEqual("$string:mainability_description");
expect(info.descriptionId > 0).assertTrue();
expect(info.systemApp).assertEqual(true);
expect(info.enabled).assertEqual(true);
expect(info.label).assertEqual("$string:entry_MainAbility");
expect(info.icon).assertEqual("$media:icon");
expect(info.process).assertEqual("");
expect(info.supportedModes).assertEqual(0);
expect(info.entryDir).assertEqual("/data/app/el1/bundle/public/" +
"com.ohos.acecollaboration/com.ohos.acecollaboration");
console.log(msg+ "---checkApplicationInfo End--- ");
}
})
})
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录