Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
97201a1e
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看板
未验证
提交
97201a1e
编写于
8月 01, 2022
作者:
O
openharmony_ci
提交者:
Gitee
8月 01, 2022
浏览文件
操作
浏览文件
下载
差异文件
!4713 【Distributeddatamgr】【master】适配失败用例 覆盖率补齐
Merge pull request !4713 from 梁梁/master
上级
ec8d880f
51f91ef3
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
568 addition
and
6 deletion
+568
-6
distributeddatamgr/appdatamgrjstest/hap/src/main/js/test/List.test.js
...atamgr/appdatamgrjstest/hap/src/main/js/test/List.test.js
+2
-0
distributeddatamgr/appdatamgrjstest/hap/src/main/js/test/RdbstoreInsertJsunit.test.js
...rjstest/hap/src/main/js/test/RdbstoreInsertJsunit.test.js
+26
-0
distributeddatamgr/appdatamgrjstest/hap/src/main/js/test/SystemStorageJsunit.test.js
...grjstest/hap/src/main/js/test/SystemStorageJsunit.test.js
+530
-0
distributeddatamgr/windowStage/dataShareRdbtest/entry/src/main/ets/test/DataShareCombinationRdb.ets
...btest/entry/src/main/ets/test/DataShareCombinationRdb.ets
+10
-6
未找到文件。
distributeddatamgr/appdatamgrjstest/hap/src/main/js/test/List.test.js
浏览文件 @
97201a1e
...
...
@@ -30,6 +30,7 @@ import storageCallBackTest from './StorageCallBackJsunit.test.js'
import
storageHelperTest
from
'
./StorageHelperJsunit.test.js
'
import
storagePromiseTest
from
'
./StoragePromiseJsunit.test.js
'
import
storageSyncTest
from
'
./StorageSyncJsunit.test.js
'
import
systemStorageTest
from
'
./SystemStorageJsunit.testjs
'
export
default
function
testsuite
()
{
dataAbilityPredicatesTest
()
rdbStoreBackupRestoreWithFAContextTest
()
...
...
@@ -49,4 +50,5 @@ storageCallBackTest()
storageHelperTest
()
storagePromiseTest
()
storageSyncTest
()
systemStorageTest
()
}
distributeddatamgr/appdatamgrjstest/hap/src/main/js/test/RdbstoreInsertJsunit.test.js
浏览文件 @
97201a1e
...
...
@@ -169,5 +169,31 @@ describe('rdbstoreInsertTest', function () {
done
()
console
.
info
(
TAG
+
"
************* testRdbStoreInsert0003 end *************
"
);
})
/**
* @tc.name rdb insert test
* @tc.number SUB_DDM_AppDataFWK_JSRDB_Insert_0040
* @tc.desc rdb insert test
*/
it
(
'
testRdbStoreInsert0004
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
************* testRdbStoreInsert0004 start *************
"
);
var
u8
=
new
Uint8Array
([
1
,
2
,
3
])
const
valueBucket
=
{
"
name
"
:
"
zhangsan
"
,
"
age
"
:
18
,
"
salary
"
:
null
,
"
blobType
"
:
u8
,
}
let
insertPromise
=
rdbStore
.
insert
(
"
test
"
,
valueBucket
)
insertPromise
.
then
(
async
(
ret
)
=>
{
expect
(
1
).
assertEqual
(
ret
)
console
.
log
(
TAG
+
"
insert first done:
"
+
ret
)
}).
catch
((
err
)
=>
{
console
.
log
(
TAG
+
"
insert with null table
"
)
expect
(
null
).
assertFail
()
})
done
();
console
.
log
(
TAG
+
"
************* testRdbStoreInsert0004 end *************
"
);
})
console
.
info
(
TAG
+
"
*************Unit Test End*************
"
);
})}
distributeddatamgr/appdatamgrjstest/hap/src/main/js/test/SystemStorageJsunit.test.js
0 → 100644
浏览文件 @
97201a1e
/*
* Copyright (c) 2022 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
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
import
storage
from
'
@system.storage
'
;
const
TAG
=
'
[SYSTEM_STORAGE_JSKITS_TEST]
'
export
default
function
SystemStorageJsunit
(){
describe
(
'
systemStorageTest
'
,
function
()
{
beforeAll
(
function
()
{
console
.
info
(
TAG
+
'
beforeAll
'
)
})
beforeEach
(
function
()
{
console
.
info
(
TAG
+
'
beforeEach
'
)
})
afterEach
(
async
function
(
done
)
{
console
.
info
(
TAG
+
'
afterEach
'
)
let
promise
=
storage
.
clear
({
success
:
function
()
{
expect
(
true
).
assertTrue
();
done
();
},
fail
:
function
(
data
,
errCode
)
{
expect
(
false
).
assertTrue
();
done
();
}
});
await
promise
;
done
();
})
afterAll
(
function
()
{
console
.
info
(
TAG
+
'
afterAll
'
)
})
/**
* @tc.name testSet001
* @tc.number SUB_DDM_AppDataFWK_SystemStorage_Set_0001
* @tc.desc set and can get correct value in success callback, finally get complete callback
*/
it
(
'
testSet001
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
************* testSet001 start *************
'
);
let
completeRet
=
false
;
let
successRet
=
false
;
let
promise1
=
storage
.
set
({
key
:
'
storageKey
'
,
value
:
'
testVal
'
,
success
:
async
function
()
{
successRet
=
true
;
await
expect
(
successRet
).
assertTrue
();
},
complete
:
async
function
()
{
completeRet
=
true
;
await
expect
(
completeRet
).
assertTrue
();
}
});
await
promise1
;
let
promise2
=
storage
.
get
({
key
:
'
storageKey
'
,
success
:
async
function
(
data
)
{
await
expect
(
data
).
assertEqual
(
'
testVal
'
);
}
})
await
promise2
;
await
expect
(
successRet
).
assertTrue
();
await
expect
(
completeRet
).
assertTrue
();
done
();
console
.
info
(
TAG
+
'
************* testSet001 end *************
'
);
})
/**
* @tc.name testSet002
* @tc.number SUB_DDM_AppDataFWK_SystemStorage_Set_0002
* @tc.desc set null key can receive fail callback
*/
it
(
'
testSet002
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
************* testSet002 start *************
'
);
let
testData
=
undefined
;
let
testErrCode
=
undefined
;
let
compelteRet
=
false
;
let
promise
=
storage
.
set
({
key
:
''
,
value
:
'
testValue
'
,
success
:
async
function
()
{
await
expect
(
false
).
assertTrue
();
},
fail
:
async
function
(
data
,
errCode
)
{
testData
=
data
;
testErrCode
=
errCode
;
},
complete
:
async
function
()
{
compelteRet
=
true
;
await
expect
(
compelteRet
).
assertTrue
();
}
})
await
promise
;
await
expect
(
"
The key string is null or empty.
"
).
assertEqual
(
testData
);
await
expect
(
-
1006
).
assertEqual
(
testErrCode
);
await
expect
(
compelteRet
).
assertTrue
();
done
();
console
.
info
(
TAG
+
'
************* testSet002 end *************
'
);
})
/**
* @tc.name testSet003
* @tc.number SUB_DDM_AppDataFWK_SystemStorage_Set_0003
* @tc.desc set key which size over 32 bytes and can receive fail callback
*/
it
(
'
testSet003
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
************* testSet003 start *************
'
);
let
testData
=
undefined
;
let
testErrCode
=
undefined
;
let
compelteRet
=
false
;
let
promise
=
storage
.
set
({
key
:
'
x
'
.
repeat
(
33
),
value
:
'
testValue
'
,
success
:
async
function
()
{
await
expect
(
false
).
assertTrue
();
},
fail
:
async
function
(
data
,
errCode
)
{
testData
=
data
;
testErrCode
=
errCode
;
},
complete
:
async
function
()
{
compelteRet
=
true
;
await
expect
(
compelteRet
).
assertTrue
();
}
})
await
promise
;
await
expect
(
"
The key string length should shorter than 32.
"
).
assertEqual
(
testData
);
await
expect
(
-
1016
).
assertEqual
(
testErrCode
);
await
expect
(
compelteRet
).
assertTrue
();
done
();
console
.
info
(
TAG
+
'
************* testSet003 end *************
'
);
})
/**
* @tc.name testSet004
* @tc.number SUB_DDM_AppDataFWK_SystemStorage_Set_0004
* @tc.desc set value which size over 128 bytes and can receive fail callback
*/
it
(
'
testSet004
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
************* testSet004 start *************
'
);
let
testData
=
undefined
;
let
testErrCode
=
undefined
;
let
compelteRet
=
false
;
let
promise
=
storage
.
set
({
key
:
'
testKey
'
,
value
:
'
x
'
.
repeat
(
129
),
success
:
async
function
()
{
await
expect
(
false
).
assertTrue
();
},
fail
:
async
function
(
data
,
errCode
)
{
testData
=
data
;
testErrCode
=
errCode
;
},
complete
:
async
function
()
{
compelteRet
=
true
;
}
})
await
promise
;
await
expect
(
"
The value string length should shorter than 128.
"
).
assertEqual
(
testData
);
await
expect
(
-
1017
).
assertEqual
(
testErrCode
);
await
expect
(
compelteRet
).
assertTrue
();
done
();
console
.
info
(
TAG
+
'
************* testSet004 end *************
'
);
})
/**
* @tc.name testGet001
* @tc.number SUB_DDM_AppDataFWK_SystemStorage_Get_0001
* @tc.desc set and can get correct value in success callback, finally receive a get complete callback
*/
it
(
'
testGet001
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
************* testGet001 start *************
'
);
let
completeRet
=
false
;
let
promise1
=
storage
.
set
({
key
:
'
storageKey
'
,
value
:
'
storageVal
'
,
success
:
async
function
()
{
await
expect
(
true
).
assertTrue
();
},
fail
:
async
function
(
data
,
err
)
{
await
expect
(
false
).
assertTrue
();
},
});
await
promise1
;
let
promise2
=
storage
.
get
({
key
:
'
storageKey
'
,
success
:
async
function
(
data
)
{
await
expect
(
'
storageVal
'
).
assertEqual
(
data
);
},
complete
:
async
function
()
{
completeRet
=
true
;
await
expect
(
completeRet
).
assertTrue
();
}
});
await
promise2
;
await
expect
(
completeRet
).
assertTrue
();
done
();
console
.
info
(
TAG
+
'
************* testGet001 end *************
'
);
})
/*
* @tc.name testGet002
* @tc.number SUB_DDM_AppDataFWK_SystemStorage_Get_0002
* @tc.desc get value without set any value and can get default in success callback
*/
it
(
'
testGet002
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
************* testGet002 start *************
'
);
let
completeRet
=
false
;
let
promise
=
storage
.
get
({
key
:
'
storageKey
'
,
default
:
'
123
'
,
success
:
async
function
(
data
)
{
await
expect
(
'
123
'
).
assertEqual
(
data
);
},
fail
:
async
function
(
data
,
err
)
{
await
expect
(
false
).
assertTrue
();
},
complete
:
async
function
()
{
completeRet
=
true
;
await
expect
(
completeRet
).
assertTrue
();
}
})
await
promise
;
await
expect
(
completeRet
).
assertTrue
();
done
();
console
.
info
(
TAG
+
'
************* testGet002 end *************
'
);
})
/*
* @tc.name testGet003
* @tc.number SUB_DDM_AppDataFWK_SystemStorage_Get_0003
* @tc.desc get default size over 128 and can receive fail callback
*/
it
(
'
testGet003
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
************* testGet003 start *************
'
);
let
testVal
=
undefined
;
let
testData
=
undefined
;
let
testErrCode
=
undefined
;
let
completeRet
=
false
;
let
failRet
=
false
;
let
promise
=
storage
.
get
({
key
:
'
storageKey
'
,
default
:
'
x
'
.
repeat
(
129
),
success
:
async
function
(
data
)
{
testVal
=
data
;
},
fail
:
async
function
(
data
,
errCode
)
{
testErrCode
=
errCode
;
testData
=
data
;
failRet
=
true
;
},
complete
:
async
function
()
{
completeRet
=
true
;
await
expect
(
completeRet
).
assertTrue
();
}
})
await
promise
;
expect
(
failRet
).
assertTrue
();
expect
(
completeRet
).
assertTrue
();
expect
(
-
1018
).
assertEqual
(
testErrCode
);
expect
(
'
The default string length should shorter than 128.
'
).
assertEqual
(
testData
);
expect
(
testVal
==
undefined
).
assertTrue
();
done
();
console
.
info
(
TAG
+
'
************* testGet003 end *************
'
);
})
/*
* @tc.name testGet004
* @tc.number SUB_DDM_AppDataFWK_SystemStorage_Get_0004
* @tc.desc get null key and can return default value
*/
it
(
'
testGet004
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
************* testGet004 start *************
'
);
let
testVal
=
undefined
;
let
completeRet
=
false
;
let
promise
=
storage
.
get
({
key
:
''
,
default
:
'
storageVal
'
,
success
:
async
function
(
data
)
{
await
expect
(
data
).
assertEqual
(
'
storageVal
'
);
},
fail
:
async
function
(
data
,
err
)
{
await
expect
(
false
).
assertTrue
();
},
complete
:
async
function
()
{
completeRet
=
true
;
await
expect
(
completeRet
).
assertTrue
();
}
})
await
promise
;
await
expect
(
completeRet
).
assertTrue
();
done
();
console
.
info
(
TAG
+
'
************* testGet004 end *************
'
);
})
/*
* @tc.name testDelete001
* @tc.number SUB_DDM_AppDataFWK_SystemStorage_Delete_0001
* @tc.desc delete value and can not get value
*/
it
(
'
testDelete001
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
************* testDelete001 start *************
'
);
let
completeRet
=
false
;
let
successRet
=
false
;
let
promise1
=
storage
.
set
({
key
:
'
storageKey
'
,
value
:
'
storageVal
'
,
success
:
async
function
()
{
await
expect
(
true
).
assertTrue
();
},
fail
:
async
function
(
data
,
err
)
{
await
expect
(
false
).
assertTrue
();
},
})
await
promise1
;
let
promise2
=
storage
.
delete
({
key
:
"
storageKey
"
,
success
:
async
function
()
{
successRet
=
true
;
await
expect
(
successRet
).
assertTrue
();
},
complete
:
async
function
()
{
completeRet
=
true
;
await
expect
(
completeRet
).
assertTrue
();
}
});
await
promise2
;
let
promise3
=
storage
.
get
({
key
:
'
storageKey
'
,
default
:
'
testVal
'
,
success
:
async
function
(
data
)
{
await
expect
(
data
).
assertEqual
(
'
testVal
'
);
}
})
await
promise3
;
await
expect
(
completeRet
).
assertTrue
();
await
expect
(
successRet
).
assertTrue
();
done
();
console
.
info
(
TAG
+
'
************* testDelete001 end *************
'
);
})
/*
* @tc.name testDelete002
* @tc.number SUB_DDM_AppDataFWK_SystemStorage_Delete_0002
* @tc.desc delete null key and can get fail callback
*/
it
(
'
testDelete002
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
************* testDelete002 start *************
'
);
let
testData
=
undefined
;
let
testErrCode
=
undefined
;
let
completeRet
=
false
;
let
failRet
=
false
;
let
promise1
=
storage
.
set
({
key
:
'
storageKey
'
,
value
:
'
storageVal
'
,
success
:
async
function
()
{
await
expect
(
true
).
assertTrue
();
},
fail
:
async
function
(
data
,
err
)
{
await
expect
(
false
).
assertTrue
();
},
})
await
promise1
;
let
promise2
=
storage
.
delete
({
key
:
''
,
success
:
async
function
()
{
await
expect
(
false
).
assertTrue
();
},
fail
:
async
function
(
data
,
err
)
{
testErrCode
=
err
;
testData
=
data
;
failRet
=
true
;
},
complete
:
async
function
()
{
completeRet
=
true
;
await
expect
(
completeRet
).
assertTrue
();
}
})
await
promise2
;
await
expect
(
completeRet
).
assertTrue
();
await
expect
(
"
The key string is null or empty.
"
).
assertEqual
(
testData
);
await
expect
(
-
1006
).
assertEqual
(
testErrCode
);
await
expect
(
failRet
).
assertTrue
();
done
();
console
.
info
(
TAG
+
'
************* testDelete002 end *************
'
);
})
/*
* @tc.name testDelete003
* @tc.number SUB_DDM_AppDataFWK_SystemStorage_Delete_0003
* @tc.desc delete incorrect key and can get success callback
*/
it
(
'
testDelete003
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
************* testDelete003 start *************
'
);
let
completeRet
=
false
;
let
promise1
=
storage
.
set
({
key
:
'
storageKey
'
,
value
:
'
test
'
,
success
:
async
function
()
{
await
expect
(
true
).
assertTrue
();
},
fail
:
async
function
()
{
await
expect
(
false
).
assertTrue
();
},
});
await
promise1
;
let
promise2
=
storage
.
delete
({
key
:
'
123
'
,
success
:
async
function
()
{
await
expect
(
true
).
assertTrue
();
},
fail
:
async
function
(
data
,
err
)
{
await
expect
(
false
).
assertTrue
();
},
complete
:
async
function
()
{
completeRet
=
true
;
expect
(
completeRet
).
assertTrue
();
}
});
await
promise2
;
let
promise3
=
storage
.
get
({
key
:
'
storageKey
'
,
success
:
async
function
(
data
)
{
await
expect
(
data
).
assertEqual
(
'
test
'
);
},
fail
:
async
function
(
data
,
err
)
{
await
expect
(
false
).
assertTrue
();
}
})
await
promise3
;
await
expect
(
completeRet
).
assertTrue
();
done
();
console
.
info
(
TAG
+
'
************* testDelete003 end *************
'
);
})
/*
* @tc.name testClear001
* @tc.number SUB_DDM_AppDataFWK_SystemStorage_Clear_0001
* @tc.desc clear and can receive success callback
*/
it
(
'
testClear001
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
************* testClear001 start *************
'
);
let
successRet
=
false
;
let
compelteRet
=
false
;
let
promise1
=
storage
.
set
({
key
:
'
storageKey1
'
,
value
:
'
storageVal1
'
,
success
:
async
function
()
{
await
expect
(
true
).
assertTrue
();
},
fail
:
async
function
()
{
await
expect
(
false
).
assertTrue
();
},
});
await
promise1
;
let
promise2
=
storage
.
set
({
key
:
'
storageKey2
'
,
value
:
'
storageVal2
'
,
success
:
async
function
()
{
await
expect
(
true
).
assertTrue
();
},
fail
:
async
function
()
{
await
expect
(
false
).
assertTrue
();
},
});
await
promise2
;
let
promise3
=
storage
.
clear
({
success
:
async
function
()
{
successRet
=
true
;
await
expect
(
successRet
).
assertTrue
();
},
fail
:
async
function
(
data
,
err
)
{
await
expect
(
false
).
assertTrue
();
},
complete
:
async
function
()
{
compelteRet
=
true
;
await
expect
(
compelteRet
).
assertTrue
();
}
});
await
promise3
;
await
expect
(
successRet
).
assertTrue
();
done
();
console
.
info
(
TAG
+
'
************* testClear001 end *************
'
);
})
})
}
\ No newline at end of file
distributeddatamgr/windowStage/dataShareRdbtest/entry/src/main/ets/test/DataShareCombinationRdb.ets
浏览文件 @
97201a1e
...
...
@@ -293,18 +293,22 @@ export default function DataShareCombinationRdb() {
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 1
*/
*/
it('DataShareNotifyChangeRdb0101', 1, async function (done) {
try {
let Count = 1;
globalThis.helper.on("dataChange", uri, function (data) {
globalThis.helper.on("dataChange", uri, function (
err,
data) {
if (Count < 4) {
console.info("TestDataShare notifyChange = " + data);
expect(true).assertEqual(data != null);
console.info("TestDataShare notifyChange err = " + err);
console.info("TestDataShare notifyChange data = " + data);
expect(true).assertEqual(err == null);
expect(true).assertEqual(data == null);
Count = Count + 1;
} else {
console.info("TestDataShare notifyChange = " + data);
expect(true).assertEqual(data != null);
console.info("TestDataShare notifyChange err = " + err);
console.info("TestDataShare notifyChange data = " + data);
expect(true).assertEqual(err == null);
expect(true).assertEqual(data == null);
globalThis.helper.off("dataChange", uri);
console.info("TestDataShare off");
done();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录