AdonisJS API
    Preparing search index...
    • Hooks AdonisJS Session with the Japa API client plugin. Provides session methods and assertions for API testing.

      Parameters

      • app: ApplicationService

        AdonisJS application service

      Returns PluginFn

      // Register in test setup
      import { sessionApiClient } from '@adonisjs/session/plugins/japa/api_client'

      // Use in API tests
      test('can authenticate user', async ({ client }) => {
      const response = await client
      .post('/login')
      .withSession({ remember: true })
      .json({ email: 'user@example.com', password: 'secret' })

      response.assertSession('userId', 123)
      response.assertFlashMessage('success', 'Welcome back!')
      })