Lessons

Our series are curated collections of lessons that walk through a specific topic from beginning to end. Series are a great way to learn a topic in a structured way.

Video preview
Adocasts Plus Exclusive
Exclusive
Piecing it all together
Video preview

Piecing It All Together

In this lesson, we'll piece everything we've learned thus far together and create functional tests for a route allowing the authenticated user to change their email. This encompasses authentication, email sending, database records, and more

Video preview
Adocasts Plus Exclusive
Exclusive
Testing Authorization with Bouncer
Video preview

Testing Authorization with Bouncer

In this lesson, we'll learn to test AdonisJS Authentication with Bouncer for actions like deleting a post. We'll cover happy paths where authorization is granted and sad paths where authorization is denied and the action is forbidden.

Video preview
Adocasts Plus Exclusive
Exclusive
Testing Auth Protected Routes
Video preview

Testing Auth Protected Routes

In this lesson, we'll learn how to test auth-protected routes via the auth middleware and non-auth-protected routes via the guest middleware. We'll ensure our user is redirected appropriately and shown a flash message where applicable

Video preview
Adocasts Plus Exclusive
Exclusive
The Japa Auth Plugin
Video preview

The Auth Plugin

In this lesson, we'll learn how to test authenticated routes in AdonisJS/Japa. First, we'll install and register the Auth API Client plugin. Then, we'll learn how to use our User Factory to create a user and login as them for our test's request.

Video preview
Adocasts Plus Exclusive
Exclusive
Testing Model Logic
Video preview

Testing Model Logic

In this lesson, we'll learn how to Unit Test AdonisJS Model logic using Japa. We'll test a password reset token's validity to show instance-level tests. Then, we'll test its generate and verify methods to show static methods.

Video preview
Adocasts Plus Exclusive
Exclusive
Testing with Lucid Model Factories
Video preview

Testing with Lucid Model Factories

In this lesson, we'll learn about AdonisJS Model Factories and how we can use them to create realistic, yet fake, test data. We'll create a few factories we'll use in this series and learn how we can stub or create data with them in tests.

Video preview
Adocasts Plus Exclusive
Exclusive
Database Driven Endpoints
Video preview

Testing Database-Driven Endpoints

In this lesson, we'll learn how to functionally test a registration endpoint using a test database. We'll learn about global transactions and how we can use them to easily reset our database between tests and confirm database state with Lucid.

Video preview
Adocasts Plus Exclusive
Exclusive
Database Hooks
Video preview

Database Test Runner Hooks

In this lesson, we'll learn how to set up a dedicated test database to ensure clean, isolated testing. We'll configure a separate SQLite database using a test environment variable and set up Japa runner hooks to automatically migrate and seed our database

Video preview
Adocasts Plus Exclusive
Exclusive
Testing File Uploads
Video preview

Testing File Uploads

In this lesson, we'll learn how to test AdonisJS file uploads using Drive Fakes and the Japa API Client. We'll generate fake files for testing, use a multipart request, assert successes, test validation failures, and impress the importance of cleanup.

Video preview
Adocasts Plus Exclusive
Exclusive
Asserting OpenAPI Specifications
Video preview

Asserting OpenAPI Specifications

In this lesson, we'll learn how to validate AdonisJS API responses against an OpenAPI Specification, like those generated by Swagger APIs, using Japa's OpenAPI Assertions plugin.

Video preview
Adocasts Plus Exclusive
Exclusive
Asserting JSON Structures
Video preview

Asserting JSON Structures

In this lesson, we'll learn how to test fetching a list of items functionally. Assert a successful response, confirm the body is as we expect, check object structures, and loosely validate response data.

Video preview
Adocasts Plus Exclusive
Exclusive
Testing Client Validations
Video preview

testing VineJS Validations & Working with CSRF

In this lesson, learn Functional Testing for POST requests. We'll cover sending JSON and form payloads and how to assert validation errors. We'll also discuss how to set up and use CSRF protection with the Session and Shield plugins.

Video preview
Adocasts Plus Exclusive
Exclusive
Testing Ace CLI Commands
Video preview

Testing Ace Console Commands

In this lesson, we'll learn how to test AdonisJS Ace Commands with Japa. We'll cover how to instantiate and execute the command, while passing arguments and capturing prompts. We'll also discuss asserting logged statements sent from the command.

Video preview
Adocasts Plus Exclusive
Exclusive
Testing GET Requests
Video preview

Testing GET Endpoints

In this lesson, we'll write Functional Tests to test an AdonisJS route using the Japa API Client. Learn to test happy paths by asserting successful responses and sad paths by asserting purposefully failed responses.

Video preview
Adocasts Plus Exclusive
Exclusive
Video preview

Meet the API Client

In this lesson, learn how to use Japa's API Client for Functional Testing of AdonisJS routes. We'll install and register the plugin, and use the client in tests to make requests and assert against their responses.

Video preview
Adocasts Plus Exclusive
Exclusive
Functional vs Unit Testing
Video preview

Functional vs Unit Testing

In this lesson, we'll distinguish between Unit and Functional testing. We'll discuss how Unit tests are for isolated code and are lightweight, while Functional tests boot the HTTP server to test the entire application stack from request to response.

Video preview
Adocasts Plus Exclusive
Exclusive
Unit Testing Event Listeners
Video preview

Unit Testing Event Listeners

In this lesson, learn how to unit test AdonisJS Event Listeners with Japa. Use the Mail Fake to isolate the test, instantiate the listener, manually call the listener and pass data, and use assertions to confirm the expected email was queued.

Video preview
Adocasts Plus Exclusive
Exclusive
Dependency Fakes
Video preview

Introduction to Fakes

In this lesson, we'll use AdonisJS Fakes in Japa for isolated testing of service dependencies (like email). Learn to put the mail service in fake mode, call the service method, use built-in assertions, and ensure proper cleanup.

Showing 1 to 18 of 457 results

Topic