Notes Used to Craft this Lesson
Similar to session and shield, AdonisJS Auth has an API Client plugin we can use to add helpful authentication methods for our tests.
// tests/bootstrap.ts
import { authApiClient } from "@adonisjs/auth/plugins/api_client";
// ...
export const plugins: Config["plugins"] = [
assert(),
openapi({
schemas: [new URL("../docs/openapi.json", import.meta.url)],
}),
apiClient(),
pluginAdonisJS(app),
++ authApiClient(app),
sessionApiClient(app),
shieldApiClient(),
disallowPinnedTests({
disallow: !!process.env.CI,
}),
];