generated from AthennaIO/Template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #236 from AthennaIO/develop
chore(npm): update dependencies
- Loading branch information
Showing
6 changed files
with
87 additions
and
8 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/** | ||
* @athenna/core | ||
* | ||
* (c) João Lenon <lenon@athenna.io> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
import { CronImpl } from '@athenna/cron' | ||
import { Path, Options } from '@athenna/common' | ||
import { AfterAll, BeforeAll } from '@athenna/test' | ||
import { Ignite, type CronOptions, type IgniteOptions } from '#src' | ||
|
||
export class BaseCronTest { | ||
public ignite: Ignite | ||
public cron: CronImpl | ||
public cronOptions: CronOptions = {} | ||
public igniteOptions: IgniteOptions = {} | ||
|
||
@BeforeAll() | ||
public async baseBeforeAll() { | ||
this.ignite = await new Ignite().load( | ||
Path.toHref(Path.bin(`test.${Path.ext()}`)), | ||
this.getIgniteOptions() | ||
) | ||
|
||
this.cron = await this.ignite.cron(this.getCronOptions()) | ||
} | ||
|
||
@AfterAll() | ||
public async baseAfterAll() { | ||
await this.cron.close() | ||
} | ||
|
||
private getCronOptions() { | ||
return Options.create(this.cronOptions, {}) | ||
} | ||
|
||
private getIgniteOptions() { | ||
return Options.create(this.igniteOptions, { | ||
bootLogs: false, | ||
loadConfigSafe: false, | ||
environments: ['test'] | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { Test, type Context } from '@athenna/test' | ||
import { BaseCronTest } from '@athenna/core/testing/BaseCronTest' | ||
|
||
export default class {{ namePascal }} extends BaseCronTest { | ||
@Test() | ||
public async shouldBeAbleToRunSchedulers({ scheduler }: Context) { | ||
await scheduler.runByName('MySchedulerClassName') | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters