Skip to content

Commit

Permalink
test(cron): remove repeated callback variables and adjust test time…
Browse files Browse the repository at this point in the history
…outs

# Short Description

The changes in this commit remove repeated `callback` variables from the cron tests and adjust the test timeouts to use the `tickAsync` method instead of `tick`.

## Detailed Changes

1. Removed repeated `callback` variables from several test cases.
2. Adjusted the test timeouts to use the `tickAsync` method instead of `tick` to ensure the tests properly wait for the asynchronous operations to complete.
3. Removed the `done` callback from the test cases and instead used the `async` function syntax to handle the asynchronous nature of the tests.

## Motivation

These changes improve the readability and maintainability of the cron tests by removing unnecessary variables and ensuring the tests properly handle the asynchronous nature of the CronJob functionality.
  • Loading branch information
Zamoca42 committed Sep 3, 2024
1 parent da5d5a9 commit 6b35879
Show file tree
Hide file tree
Showing 2 changed files with 168 additions and 137 deletions.
9 changes: 0 additions & 9 deletions src/job.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@ export class CronJob<OC extends CronOnCompleteCommand | null = null, C = null> {

async fireOnTick() {
if (this.isRunning) {
console.debug('[Cron] job is already running');
return;
}

Expand Down Expand Up @@ -307,14 +306,6 @@ export class CronJob<OC extends CronOnCompleteCommand | null = null, C = null> {
/**
* Stop the cronjob.
*/
// stop() {
// if (this._timeout) clearTimeout(this._timeout);
// this.running = false;
// if (typeof this.onComplete === 'function') {
// void this.onComplete.call(this.context);
// }
// }

stop() {
if (this._timeout) clearTimeout(this._timeout);
this.running = false;
Expand Down
Loading

0 comments on commit 6b35879

Please sign in to comment.