wikipedia-game-solver/apps/api/tests/bootstrap.ts
Théo LUDWIG 4add77856e
All checks were successful
Chromatic / chromatic (push) Successful in 2m58s
CI / ci (push) Successful in 4m43s
CI / commitlint (push) Successful in 15s
chore: try Adonis Tuyau
2024-08-16 01:50:11 +01:00

46 lines
1.2 KiB
TypeScript

import app from "@adonisjs/core/services/app"
import testUtils from "@adonisjs/core/services/test_utils"
import { apiClient } from "@japa/api-client"
import { assert } from "@japa/assert"
import { pluginAdonisJS } from "@japa/plugin-adonisjs"
import type { Config } from "@japa/runner/types"
/**
* This file is imported by the "bin/test.ts" entrypoint file
*/
/**
* Configure Japa plugins in the plugins array.
* Learn more - https://japa.dev/docs/runner-config#plugins-optional
*/
export const plugins: Config["plugins"] = [
assert(),
apiClient(),
pluginAdonisJS(app),
]
/**
* Configure lifecycle function to run before and after all the tests.
*
* The setup functions are executed before all the tests.
* The teardown functions are executer after all the tests.
*/
export const runnerHooks: Required<Pick<Config, "setup" | "teardown">> = {
setup: [
async () => {
return await testUtils.db().truncate()
},
],
teardown: [],
}
/**
* Configure suites by tapping into the test suite instance.
* Learn more - https://japa.dev/docs/test-suites#lifecycle-hooks
*/
export const configureSuite: Config["configureSuite"] = (suite) => {
return suite.setup(async () => {
return await testUtils.httpServer().start()
})
}