提交 0eeff305 编写于 作者: Z zhaimengchao

【account】【master】OnOff文件sleep方法重写

Signed-off-by: Nzhaimengchao <zhaimengchao@huawei.com>
上级 f81cd062
...@@ -21,15 +21,15 @@ const TIMEOUT = 2000; ...@@ -21,15 +21,15 @@ const TIMEOUT = 2000;
export default function ActsAccountChangeOnOff() { export default function ActsAccountChangeOnOff() {
describe('ActsAccountChangeOnOff', async function () { describe('ActsAccountChangeOnOff', async function () {
function sleep(delay) { async function sleep(delay) {
return new Promise((resolve, reject) => { let timeoutId = null;
setTimeout(() => { var promise = new Promise((resolve, reject) => {
resolve() timeoutId = setTimeout(() => resolve("done!"), delay);
}, delay) });
}).then(() => { await promise
console.info(`sleep #{time} over ...`) clearTimeout(timeoutId)
})
} }
beforeAll(async function (done) { beforeAll(async function (done) {
done(); done();
}); });
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册