Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
f8f12253
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
f8f12253
编写于
1月 27, 2022
作者:
O
openharmony_ci
提交者:
Gitee
1月 27, 2022
浏览文件
操作
浏览文件
下载
差异文件
!1711 【全局资源调度子系统】【master】增加代理提醒类JS API测试用例
Merge pull request !1711 from 南先森/reource0125
上级
0adadfc0
f1ae8511
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
591 addition
and
41 deletion
+591
-41
resourceschedule/resourceschedule_standard/reminderagent/Test.json
...chedule/resourceschedule_standard/reminderagent/Test.json
+1
-1
resourceschedule/resourceschedule_standard/reminderagent/src/main/config.json
...ourceschedule_standard/reminderagent/src/main/config.json
+3
-3
resourceschedule/resourceschedule_standard/reminderagent/src/main/js/default/i18n/zh-CN.json
...tandard/reminderagent/src/main/js/default/i18n/zh-CN.json
+1
-1
resourceschedule/resourceschedule_standard/reminderagent/src/main/js/default/test/ReminderAgentJs.test.js
...deragent/src/main/js/default/test/ReminderAgentJs.test.js
+586
-36
未找到文件。
resourceschedule/resourceschedule_standard/reminderagent/Test.json
浏览文件 @
f8f12253
...
...
@@ -3,7 +3,7 @@
"driver"
:
{
"type"
:
"JSUnitTest"
,
"test-timeout"
:
"300000"
,
"package"
:
"ohos.acts.resourceschedule.reminderagentjs.function"
,
"package"
:
"ohos.acts.resourceschedule.reminderagent
.
js.function"
,
"shell-timeout"
:
"60000"
},
"kits"
:
[
...
...
resourceschedule/resourceschedule_standard/reminderagent/src/main/config.json
浏览文件 @
f8f12253
{
"app"
:
{
"bundleName"
:
"ohos.acts.resourceschedule.reminderagentjs.function"
,
"bundleName"
:
"ohos.acts.resourceschedule.reminderagent
.
js.function"
,
"vendor"
:
"example"
,
"version"
:
{
"code"
:
1
,
...
...
@@ -13,7 +13,7 @@
},
"deviceConfig"
:
{},
"module"
:
{
"package"
:
"ohos.acts.resourceschedule.reminderagentjs.function"
,
"package"
:
"ohos.acts.resourceschedule.reminderagent
.
js.function"
,
"name"
:
".MyApplication"
,
"deviceType"
:
[
"phone"
...
...
@@ -36,7 +36,7 @@
]
}
],
"name"
:
"ohos.acts.resourceschedule.reminderagentjs.function.MainAbility"
,
"name"
:
"ohos.acts.resourceschedule.reminderagent
.
js.function.MainAbility"
,
"icon"
:
"$media:icon"
,
"description"
:
"$string:mainability_description"
,
"label"
:
"$string:app_name"
,
...
...
resourceschedule/resourceschedule_standard/reminderagent/src/main/js/default/i18n/zh-CN.json
浏览文件 @
f8f12253
{
"strings"
:
{
"hello"
:
"您好"
,
"world"
:
"
世界
"
"world"
:
"
鸿蒙
"
}
}
\ No newline at end of file
resourceschedule/resourceschedule_standard/reminderagent/src/main/js/default/test/ReminderAgentJs.test.js
浏览文件 @
f8f12253
...
...
@@ -15,69 +15,619 @@
// @ts-nocheck
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
import
deviceinfo
from
'
@ohos.deviceInfo
'
import
router
from
'
@system.router
'
import
notification
from
'
@ohos.notification
'
import
reminderAgent
from
'
@ohos.reminderAgent
'
describe
(
'
ReminderAgentTest
'
,
function
()
{
const
MAX_CHARACTERS_NUM_ONE
=
33
;
const
MAX_CHARACTERS_NUM_TWO
=
65
;
const
MAX_CHARACTERS_NUM
=
0
;
const
TRIGGER_TIME_IN_SECONDS
=
100
;
beforeAll
(
function
()
{
beforeAll
(
function
()
{
/*
* @tc.setup: setup invoked before all testcases
*/
console
.
info
(
'
beforeAll caled
'
)
})
})
afterAll
(
function
()
{
afterAll
(
function
()
{
/*
* @tc.teardown: teardown invoked after all testcases
*/
console
.
info
(
'
afterAll caled
'
)
})
})
beforeEach
(
function
()
{
beforeEach
(
function
()
{
/*
* @tc.setup: setup invoked before each testcases
*/
console
.
info
(
'
beforeEach caled
'
)
})
})
afterEach
(
function
()
{
afterEach
(
function
()
{
/*
* @tc.teardown: teardown invoked after each testcases
*/
console
.
info
(
'
afterEach caled
'
)
})
})
console
.
info
(
'
start################################start
'
);
/**
* @tc.number SUB_STARTUP_JS_DEVCEINFO_0100
* @tc.name testGetDeviceType01
* @tc.desc Get a string representing the device type.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
* @tc.number SUB_RESOURCESCHEDULE_REMINDER_AGENT_001
* @tc.name testPublishReminderNorFun001
* @tc.desc Publishes an agent-powered reminder with the promise function.
*/
it
(
'
device_info_test_001
'
,
0
,
function
()
{
console
.
info
(
'
device_info_test_001 start
'
);
let
ret
=
false
;
let
deviceTypeInfo
=
deviceinfo
.
deviceType
;
console
.
info
(
'
the value of the deviceType is :
'
+
deviceTypeInfo
);
it
(
'
testPublishReminderNorFun001
'
,
0
,
async
function
(
done
)
{
let
timer
=
{
reminderType
:
reminderAgent
.
ReminderType
.
REMINDER_TYPE_TIMER
,
triggerTimeInSeconds
:
TRIGGER_TIME_IN_SECONDS
}
let
expectId
=
-
1
;
reminderAgent
.
publishReminder
(
timer
).
then
((
reminderId
)
=>
{
expectId
=
reminderId
+
1
;
reminderAgent
.
publishReminder
(
timer
).
then
((
reminderId
)
=>
{
if
(
reminderId
===
expectId
)
{
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
done
();
},
500
);
}
},
(
error
)
=>
{
expect
(
false
).
assertTrue
();
setTimeout
(()
=>
{
done
();
},
500
);
});
});
})
expect
(
deviceTypeInfo
).
assertInstanceOf
(
'
String
'
);
if
(
deviceTypeInfo
!=
""
&&
deviceTypeInfo
!=
null
&&
deviceTypeInfo
!=
undefined
)
{
ret
=
true
;
/**
* @tc.number SUB_RESOURCESCHEDULE_REMINDER_AGENT_002
* @tc.name testPublishReminderNorFun002
* @tc.desc Publishes an agent-powered reminder with the callback function.
*/
it
(
'
testPublishReminderNorFun002
'
,
0
,
async
function
(
done
)
{
let
timer
=
{
reminderType
:
reminderAgent
.
ReminderType
.
REMINDER_TYPE_TIMER
,
triggerTimeInSeconds
:
TRIGGER_TIME_IN_SECONDS
}
let
expectId
=
-
1
;
function
reminderCallback
(
err
,
reminderId
)
{
expect
(
reminderId
).
assertEqual
(
expectId
);
}
expect
(
ret
).
assertTrue
()
console
.
info
(
'
device_info_test_001 : end
'
);
reminderAgent
.
publishReminder
(
timer
,
(
err
,
reminderId
)
=>
{
expectId
=
reminderId
+
1
;
reminderAgent
.
publishReminder
(
timer
,
reminderCallback
);
})
done
();
})
/**
* @tc.number SUB_RESOURCESCHEDULE_REMINDER_AGENT_003
* @tc.name testAddNotificationSlotNorFun001
* @tc.desc Adds a reminder notification slot with the callback function.
*/
it
(
'
testAddNotificationSlotNorFun001
'
,
0
,
async
function
(
done
)
{
function
reminderCallback
(
err
,
data
)
{
let
i
=
0
;
expect
(
0
).
assertEqual
(
i
);
}
reminderAgent
.
addNotificationSlot
(
0
,
reminderCallback
);
done
();
})
/**
* @tc.number SUB_RESOURCESCHEDULE_REMINDER_AGENT_004
* @tc.name testAddNotificationSlotNorFun002
* @tc.desc Adds a reminder notification slot with the promise function and null mySlot.
*/
it
(
'
testAddNotificationSlotNorFun002
'
,
0
,
async
function
(
done
)
{
let
mySlot
=
null
;
let
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
reminderAgent
.
addNotificationSlot
(
mySlot
).
then
(()
=>
{
resolve
();
}).
catch
(
function
(
err
)
{
reject
(
new
Error
(
'
errr occurred.
'
));
console
.
info
(
'
error:
'
+
err
.
code
);
}
);
promise
.
then
(()
=>
{
},
err
=>
{
let
i
=
0
;
expect
(
0
).
assertEqual
(
i
);
}).
catch
(
res
=>
{
});
done
();
})
/**
* @tc.number SUB_RESOURCESCHEDULE_REMINDER_AGENT_005
* @tc.name testAddNotificationSlotNorFun003
* @tc.desc Adds a reminder notification slot with the promise function and mySlot type 3.
*/
it
(
'
testAddNotificationSlotNorFun003
'
,
0
,
async
function
(
done
)
{
let
mySlot
=
{
type
:
3
}
reminderAgent
.
addNotificationSlot
(
mySlot
).
then
(()
=>
{
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
done
();
},
500
);
},
(
error
)
=>
{
expect
(
false
).
assertTrue
();
setTimeout
(()
=>
{
done
();
},
500
);
});
})
/**
* @tc.number SUB_RESOURCESCHEDULE_REMINDER_AGENT_006
* @tc.name testAddNotificationSlotNorFun004
* @tc.desc Adds a reminder notification slot with the promise function and mySlot more types.
*/
it
(
'
testAddNotificationSlotNorFun004
'
,
0
,
async
function
(
done
)
{
let
mySlot0
=
{
type
:
0
}
let
mySlot1
=
{
type
:
1
}
let
mySlot2
=
{
type
:
2
}
let
mySlot3
=
{
type
:
3
}
let
mySlot4
=
{
type
:
4
}
function
reminderCallback
(
err
,
data
)
{
if
(
err
)
{
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
done
();
},
500
);
}
reminderAgent
.
addNotificationSlot
(
mySlot0
,
reminderCallback
);
reminderAgent
.
addNotificationSlot
(
mySlot1
,
reminderCallback
);
reminderAgent
.
addNotificationSlot
(
mySlot2
,
reminderCallback
);
reminderAgent
.
addNotificationSlot
(
mySlot3
,
reminderCallback
);
reminderAgent
.
addNotificationSlot
(
mySlot4
,
reminderCallback
);
})
/**
* @tc.number SUB_RESOURCESCHEDULE_REMINDER_AGENT_007
* @tc.name testGetValidRemindersNorFun001
* @tc.desc Obtains all valid remindeers set by the current application.
*/
it
(
'
testGetValidRemindersNorFun001
'
,
0
,
async
function
(
done
)
{
let
timer
=
{
reminderType
:
reminderAgent
.
ReminderType
.
REMINDER_TYPE_TIMER
,
triggerTimeInSeconds
:
TRIGGER_TIME_IN_SECONDS
}
reminderAgent
.
publishReminder
(
timer
).
then
((
reminderId
)
=>
{
reminderAgent
.
getValidReminders
().
then
((
reminders
)
=>
{
});
setTimeout
(()
=>
{
reminderAgent
.
cancelAllReminders
().
then
(()
=>
{
reminderAgent
.
getValidReminders
().
then
((
reminders
)
=>
{
expect
(
0
).
assertEqual
(
reminders
.
length
);
});
});
},
1000
);
});
done
();
})
/**
* @tc.number SUB_RESOURCESCHEDULE_REMINDER_AGENT_008
* @tc.name testCancelAllRemindersNorFun001
* @tc.desc test cancel all reminders can cancel all exist reminders
*/
it
(
'
testCancelAllRemindersNorFun001
'
,
0
,
async
function
(
done
)
{
let
timer
=
{
reminderType
:
reminderAgent
.
ReminderType
.
REMINDER_TYPE_TIMER
,
triggerTimeInSeconds
:
TRIGGER_TIME_IN_SECONDS
}
reminderAgent
.
publishReminder
(
timer
,
(
error
,
reminderId
)
=>
{
reminderAgent
.
getValidReminders
((
err
,
reminders
)
=>
{
});
setTimeout
(()
=>
{
reminderAgent
.
cancelAllReminders
((
err
,
data
)
=>
{
reminderAgent
.
getValidReminders
().
then
((
reminders
)
=>
{
expect
(
0
).
assertEqual
(
reminders
.
length
);
});
});
},
1000
);
});
done
();
})
/**
* @tc.number SUB_RESOURCESCHEDULE_REMINDER_AGENT_009
* @tc.name testCancelRemindersNorFun001
* @tc.desc test cancelReminder with not exit reminder.
*/
it
(
'
testCancelRemindersNorFun001
'
,
0
,
async
function
(
done
)
{
let
timer
=
{
reminderType
:
reminderAgent
.
ReminderType
.
REMINDER_TYPE_TIMER
,
triggerTimeInSeconds
:
TRIGGER_TIME_IN_SECONDS
}
let
id
=
1
;
let
publishlength
=
-
1
;
let
cancellength
=
-
1
;
let
firstdiff
=
-
1
;
reminderAgent
.
publishReminder
(
timer
).
then
(()
=>
{
reminderAgent
.
getValidReminders
().
then
((
reminders
)
=>
{
publishlength
=
reminders
.
length
});
setTimeout
(()
=>
{
reminderAgent
.
cancelReminder
(
id
).
then
(()
=>
{
reminderAgent
.
getValidReminders
().
then
((
reminders
)
=>
{
cancellength
=
reminders
.
length
firstdiff
=
publishlength
-
cancellength
;
if
(
firstdiff
===
0
)
{
expect
(
0
).
assertEqual
(
firstdiff
);
}
});
});
},
1000
);
});
done
();
})
/**
* @tc.number SUB_RESOURCESCHEDULE_REMINDER_AGENT_010
* @tc.name testCancelRemindersNorFun002
* @tc.desc test cancel reminder with not exit reminder.
*/
it
(
'
testCancelRemindersNorFun002
'
,
0
,
async
function
(
done
)
{
let
timer
=
{
reminderType
:
reminderAgent
.
ReminderType
.
REMINDER_TYPE_TIMER
,
triggerTimeInSeconds
:
TRIGGER_TIME_IN_SECONDS
}
let
id
=
1
;
let
publishlength
=
-
1
;
let
cancellength
=
-
1
;
let
firstdiff
=
-
1
;
reminderAgent
.
publishReminder
(
timer
).
then
(()
=>
{
reminderAgent
.
getValidReminders
((
err
,
reminders
)
=>
{
publishlength
=
reminders
.
length
;
});
setTimeout
(()
=>
{
reminderAgent
.
cancelReminder
(
id
,
(
err
,
data
)
=>
{
reminderAgent
.
getValidReminders
((
err
,
reminders
)
=>
{
cancellength
=
reminders
.
length
;
firstdiff
=
publishlength
-
cancellength
;
if
(
firstdiff
===
0
)
{
expect
(
0
).
assertEqual
(
firstdiff
);
}
});
});
},
1000
);
});
done
();
})
/**
* @tc.number SUB_RESOURCESCHEDULE_REMINDER_AGENT_011
* @tc.name testCancelRemindersNorFun003
* @tc.desc test cancel reminder with exist reminder.
*/
it
(
'
testCancelRemindersNorFun003
'
,
0
,
async
function
(
done
)
{
let
alarm
=
{
reminderType
:
reminderAgent
.
ReminderType
.
REMINDER_TYPE_ALARM
,
hour
:
21
,
minute
:
14
,
title
:
"
this is title
"
,
content
:
"
this is content
"
}
let
publishlength
=
-
1
;
let
cancellength
=
-
1
;
let
firstdiff
=
-
1
;
reminderAgent
.
publishReminder
(
alarm
,
(
err
,
reminderId
)
=>
{
reminderAgent
.
getValidReminders
((
err
,
reminders
)
=>
{
publishlength
=
reminders
.
length
;
});
setTimeout
(()
=>
{
reminderAgent
.
cancelReminder
(
reminderId
,
(
err
,
data
)
=>
{
reminderAgent
.
getValidReminders
((
err
,
reminders
)
=>
{
cancellength
=
reminders
.
length
;
firstdiff
=
publishlength
-
cancellength
;
if
(
firstdiff
===
0
)
{
expect
(
0
).
assertEqual
(
firstdiff
);
}
else
if
(
firstdiff
===
1
)
{
expect
(
1
).
assertEqual
(
firstdiff
);
}
});
});
},
1000
);
});
done
();
})
})
/**
* @tc.number SUB_RESOURCESCHEDULE_REMINDER_AGENT_012
* @tc.name testCancelRemindersNorFun004
* @tc.desc test cancel reminder with exist reminder with the promise function.
*/
it
(
'
testCancelRemindersNorFun004
'
,
0
,
async
function
(
done
)
{
let
alarm
=
{
reminderType
:
reminderAgent
.
ReminderType
.
REMINDER_TYPE_ALARM
,
hour
:
21
,
minute
:
14
,
title
:
"
this is title
"
,
content
:
"
this is content
"
}
let
publishlength
=
-
1
;
let
cancellength
=
-
1
;
let
firstdiff
=
-
1
;
reminderAgent
.
publishReminder
(
alarm
,
(
err
,
reminderId
)
=>
{
reminderAgent
.
getValidReminders
((
err
,
reminders
)
=>
{
publishlength
=
reminders
.
length
;
});
setTimeout
(()
=>
{
reminderAgent
.
cancelReminder
(
reminderId
).
then
(()
=>
{
reminderAgent
.
getValidReminders
((
err
,
reminders
)
=>
{
cancellength
=
reminders
.
length
;
firstdiff
=
publishlength
-
cancellength
;
if
(
firstdiff
===
0
)
{
expect
(
0
).
assertEqual
(
firstdiff
);
}
else
if
(
firstdiff
===
1
)
{
expect
(
1
).
assertEqual
(
firstdiff
);
}
});
});
},
1000
);
});
done
();
})
/**
* @tc.number SUB_RESOURCESCHEDULE_REMINDER_AGENT_013
* @tc.name testGetValidRemindersNorFun002
* @tc.desc test get valid reminders verify all the information is correct.
*/
it
(
'
testGetValidRemindersNorFun002
'
,
0
,
async
function
(
done
)
{
var
alarm
=
{
reminderType
:
reminderAgent
.
ReminderType
.
REMINDER_TYPE_ALARM
,
hour
:
21
,
minute
:
14
,
title
:
"
this is title
"
,
content
:
"
this is content
"
}
var
timer
=
{
reminderType
:
reminderAgent
.
ReminderType
.
REMINDER_TYPE_TIMER
,
triggerTimeInSeconds
:
TRIGGER_TIME_IN_SECONDS
}
reminderAgent
.
publishReminder
(
timer
,
(
error
,
reminderId
)
=>
{
});
reminderAgent
.
publishReminder
(
alarm
,
(
error
,
reminderId
)
=>
{
});
setTimeout
(()
=>
{
reminderAgent
.
getValidReminders
().
then
((
reminders
)
=>
{
if
(
reminders
.
length
>=
2
)
{
let
i
=
0
;
expect
(
0
).
assertEqual
(
i
);
}
});
},
1000
);
done
();
})
/**
* @tc.number SUB_RESOURCESCHEDULE_REMINDER_AGENT_014
* @tc.name testGetValidRemindersNorFun003
* @tc.desc test get valid reminders verify all the information is correct with the callback function.
*/
it
(
'
testGetValidRemindersNorFun003
'
,
0
,
async
function
(
done
)
{
var
alarm
=
{
reminderType
:
reminderAgent
.
ReminderType
.
REMINDER_TYPE_ALARM
,
hour
:
21
,
minute
:
14
,
title
:
"
this is title
"
,
content
:
"
this is content
"
}
var
timer
=
{
reminderType
:
reminderAgent
.
ReminderType
.
REMINDER_TYPE_TIMER
,
triggerTimeInSeconds
:
TRIGGER_TIME_IN_SECONDS
}
reminderAgent
.
publishReminder
(
timer
,
(
error
,
reminderId
)
=>
{
});
reminderAgent
.
publishReminder
(
alarm
,
(
error
,
reminderId
)
=>
{
});
setTimeout
(()
=>
{
reminderAgent
.
getValidReminders
((
err
,
reminders
)
=>
{
if
(
reminders
.
length
>=
2
)
{
let
i
=
0
;
expect
(
0
).
assertEqual
(
i
);
}
});
},
1000
);
done
();
})
/**
* @tc.number SUB_RESOURCESCHEDULE_REMINDER_AGENT_015
* @tc.name testRemonveNotificationSlotNorFun001
* @tc.desc test remove notification Slot with not exist slot.
*/
it
(
'
testRemonveNotificationSlotNorFun001
'
,
0
,
async
function
(
done
)
{
function
reminderCallback
(
err
,
data
)
{
let
i
=
0
;
expect
(
0
).
assertEqual
(
i
);
}
reminderAgent
.
removeNotificationSlot
(
0
,
reminderCallback
);
done
();
})
/**
* @tc.number SUB_RESOURCESCHEDULE_REMINDER_AGENT_016
* @tc.name testRemonveNotificationSlotNorFun002
* @tc.desc test remove notification Slot with not exist slot with the promise function.
*/
it
(
'
testRemonveNotificationSlotNorFun002
'
,
0
,
async
function
(
done
)
{
let
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
reminderAgent
.
removeNotificationSlot
(
1
).
then
(()
=>
{
resolve
();
});
reject
(
new
Error
(
'
errr occurred.
'
));
});
promise
.
then
(()
=>
{
},
err
=>
{
let
i
=
0
;
expect
(
0
).
assertEqual
(
i
);
}).
catch
(
res
=>
{
});
done
();
})
/**
* @tc.number SUB_RESOURCESCHEDULE_REMINDER_AGENT_017
* @tc.name testRemonveNotificationSlotNorFun003
* @tc.desc test remove notification Slot with exist slot.
*/
it
(
'
testRemonveNotificationSlotNorFun003
'
,
0
,
async
function
(
done
)
{
let
tarRemoveSlot
=
{
type
:
1
}
reminderAgent
.
addNotificationSlot
(
tarRemoveSlot
.
type
,
(
err
,
data
)
=>
{
reminderAgent
.
removeNotificationSlot
(
tarRemoveSlot
.
type
,
(
err
,
data
)
=>
{
expect
(
0
).
assertEqual
(
err
.
code
);
});
});
done
();
})
/**
* @tc.number SUB_RESOURCESCHEDULE_REMINDER_AGENT_018
* @tc.name testRemonveNotificationSlotNorFun004
* @tc.desc test remove notification Slot with exist slot with the promise function.
*/
it
(
'
testRemonveNotificationSlotNorFun004
'
,
0
,
async
function
(
done
)
{
let
tarRemoveSlot
=
{
type
:
1
}
reminderAgent
.
addNotificationSlot
(
tarRemoveSlot
.
type
,
(
err
,
data
)
=>
{
reminderAgent
.
removeNotificationSlot
(
tarRemoveSlot
.
type
).
then
(()
=>
{
expect
(
0
).
assertEqual
(
err
.
code
);
});
});
done
();
})
/**
* @tc.number SUB_RESOURCESCHEDULE_REMINDER_AGENT_019
* @tc.name testGetValidRemindersNorFun004
* @tc.desc test get valid reminders with promise function.
*/
it
(
'
testGetValidRemindersNorFun004
'
,
0
,
async
function
(
done
)
{
let
timer
=
{
reminderType
:
reminderAgent
.
ReminderType
.
REMINDER_TYPE_TIMER
,
triggerTimeInSeconds
:
3
}
reminderAgent
.
publishReminder
(
timer
).
then
((
reminderId
)
=>
{
});
setTimeout
(()
=>
{
reminderAgent
.
getValidReminders
().
then
((
reminders
)
=>
{
expect
(
0
).
assertEqual
(
reminders
.
length
);
});
},
5000
);
done
();
})
/**
* @tc.number SUB_RESOURCESCHEDULE_REMINDER_AGENT_020
* @tc.name testGetValidRemindersNorFun005
* @tc.desc test get valid reminders with the callback function.
*/
it
(
'
testGetValidRemindersNorFun005
'
,
0
,
async
function
(
done
)
{
let
timer
=
{
reminderType
:
reminderAgent
.
ReminderType
.
REMINDER_TYPE_TIMER
,
triggerTimeInSeconds
:
3
}
reminderAgent
.
publishReminder
(
timer
).
then
((
reminderId
)
=>
{
});
setTimeout
(()
=>
{
reminderAgent
.
getValidReminders
((
err
,
reminders
)
=>
{
expect
(
0
).
assertEqual
(
reminders
.
length
);
});
},
5000
);
done
();
})
/**
* @tc.number SUB_RESOURCESCHEDULE_REMINDER_AGENT_021
* @tc.name testPublishReminderNorAlarmFun001
* @tc.desc test publish reminder with a nomal alarm promise function.
*/
it
(
'
testPublishReminderNorAlarmFun001
'
,
0
,
async
function
(
done
)
{
let
alarm
=
{
reminderType
:
reminderAgent
.
ReminderType
.
REMINDER_TYPE_ALARM
,
hour
:
21
,
minute
:
14
}
reminderAgent
.
publishReminder
(
alarm
).
then
((
reminderId
)
=>
{
if
(
reminderId
)
{
let
i
=
0
;
expect
(
0
).
assertEqual
(
i
);
}
});
done
();
})
/**
* @tc.number SUB_RESOURCESCHEDULE_REMINDER_AGENT_022
* @tc.name testPublishReminderNorAlarmFun002
* @tc.desc test publish reminder with a nomal alarm callback function.
*/
it
(
'
testPublishReminderNorAlarmFun002
'
,
0
,
async
function
(
done
)
{
let
alarm
=
{
reminderType
:
reminderAgent
.
ReminderType
.
REMINDER_TYPE_ALARM
,
hour
:
21
,
minute
:
14
}
function
reminderCallback
(
err
,
reminderId
)
{
if
(
reminderId
)
{
let
i
=
0
;
expect
(
0
).
assertEqual
(
i
);
}
}
reminderAgent
.
publishReminder
(
alarm
,
reminderCallback
);
done
();
})
/**
* @tc.number SUB_RESOURCESCHEDULE_REMINDER_AGENT_023
* @tc.name testPublishReminderAbNorFun001
* @tc.desc test publish reminder with max number limit of each application.
*/
it
(
'
testPublishReminderAbNorFun001
'
,
0
,
async
function
(
done
)
{
let
timer
=
{
reminderType
:
reminderAgent
.
ReminderType
.
REMINDER_TYPE_TIMER
,
triggerTimeInSeconds
:
TRIGGER_TIME_IN_SECONDS
}
let
maxLimitNumsOfApp
=
30
;
let
firstId
=
0
;
let
secondId
=
0
;
let
diffId
=
0
for
(
let
i
=
0
;
i
<
maxLimitNumsOfApp
;
i
++
)
{
(
function
(
i
)
{
setTimeout
(
function
()
{
reminderAgent
.
publishReminder
(
timer
).
then
((
reminderId
)
=>
{
if
(
i
===
0
)
{
firstId
=
reminderId
}
if
(
i
===
29
)
{
secondId
=
reminderId
diffId
=
secondId
-
firstId
expect
(
29
).
assertEqual
(
diffId
);
}
});
},
500
*
i
);
})(
i
);
}
done
();
})
})
})
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录