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.
- Loading branch information
Showing
6 changed files
with
84 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@athenna/core", | ||
"version": "5.1.0", | ||
"version": "5.2.0", | ||
"description": "One foundation for multiple applications.", | ||
"license": "MIT", | ||
"author": "João Lenon <[email protected]>", | ||
|
@@ -62,6 +62,7 @@ | |
"./commands/BuildCommand": "./src/commands/BuildCommand.js", | ||
"./commands/InstallCommand": "./src/commands/InstallCommand.js", | ||
"./testing/BaseHttpTest": "./src/testing/BaseHttpTest.js", | ||
"./testing/BaseCronTest": "./src/testing/BaseCronTest.js", | ||
"./testing/BaseConsoleTest": "./src/testing/BaseConsoleTest.js" | ||
}, | ||
"imports": { | ||
|
@@ -83,7 +84,7 @@ | |
"@athenna/artisan": "^5.1.0", | ||
"@athenna/common": "^5.0.0", | ||
"@athenna/config": "^5.0.0", | ||
"@athenna/cron": "^5.1.0", | ||
"@athenna/cron": "^5.2.0", | ||
"@athenna/http": "^5.1.0", | ||
"@athenna/ioc": "^5.0.0", | ||
"@athenna/logger": "^5.0.0", | ||
|
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 <[email protected]> | ||
* | ||
* 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