mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-08-04 09:39:23 +00:00
refactor: Move sleep function to seprate file
This commit is contained in:
parent
0b336d8012
commit
b6ed2f8c44
3 changed files with 10 additions and 8 deletions
|
|
@ -8,11 +8,4 @@ export { requester };
|
|||
export { translate } from '../translate';
|
||||
export { checkExistence, resetHabiticaDB } from '../../mongo';
|
||||
export * from './object-generators';
|
||||
|
||||
export async function sleep (seconds) {
|
||||
let milliseconds = seconds * 1000;
|
||||
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(resolve, milliseconds);
|
||||
});
|
||||
}
|
||||
export { sleep } from '../../sleep';
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@ afterEach((done) => {
|
|||
mongoose.connection.db.dropDatabase(done);
|
||||
});
|
||||
|
||||
export { sleep } from './sleep';
|
||||
|
||||
export function generateUser (options = {}) {
|
||||
return new User(options).toObject();
|
||||
}
|
||||
|
|
|
|||
7
test/helpers/sleep.js
Normal file
7
test/helpers/sleep.js
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
export async function sleep (seconds) {
|
||||
let milliseconds = seconds * 1000;
|
||||
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(resolve, milliseconds);
|
||||
});
|
||||
}
|
||||
Loading…
Reference in a new issue