undefined

Testing

Japa is a powerful first-party integration for testing by the AdonisJS Core Team. It comes packaged with everything you need for testing NodeJS applications including plugins for API, OpenAPI, browser tests and more.

0 Series
33 Lessons
AdonisJS Testing

Lessons

Video preview
Adocasts Plus Exclusive
Exclusive
Mock and Swap Dependencies
Video preview

Introduction to Mocks & Dependency Swapping

In this lesson, we'll cover Unit Testing services with dependencies. Learn to create a mock for a dependency and use the AdonisJS IoC Container to replace the real dependency with your mock, ensuring isolated and side-effect-free testing.

Video preview
Adocasts Plus Exclusive
Exclusive
Testing Simple Services
Video preview

Testing a Simple Service

In this lesson, we'll focus on Unit Testing in AdonisJS using Japa. Learn how to write isolated tests for a service's business logic, including asserting correct results and handling expected exceptions.

Video preview
Adocasts Plus Exclusive
Exclusive
Filtering Test Runs
Video preview

Filtering & Controlling Test Runs

In this lesson, learn how to control Japa's test execution. Ignore tests using skip, only run specific tests using pinning, and also how assigning tags can powerfully allow us to easily filter tests across specs.

Video preview
Adocasts Plus Exclusive
Exclusive
Testing with Datasets
Video preview

Data-Driven Tests with Datasets

In this lesson, learn to write DRY tests using Japa's datasets! Define an array or callback function of data (primitives or objects) to run a single test multiple times, enabling TypeScript inference, and using interpolation in the test name for context.

Video preview
Adocasts Plus Exclusive
Exclusive
Async & Error Testing
Video preview

Testing Async Code & Exceptions

In this lesson, we'll cover testing asynchronous code in AdonisJS using Japa. Learn to assert successful promises with both async/await and promise chaining. We'll then discuss testing rejected promises and what to watch for to prevent false positives.

Video preview
Video preview

Group & Test Lifecycle Hooks

In this lesson, we'll walk through a number of lifecycle hooks we can use on a per-group and per-test basis. We'll also discuss how we can run a hook for each test and how setup hooks allow a convenient cleanup method.

Video preview
Naming Tests
Video preview

Naming Tests

In this lesson, we'll discuss how to quickly write a good test name in a single, brief sentence.

Video preview
Making Assertions with Japa
Video preview

Making Assertions

In this lesson, we'll get comfy with making assertions against actual and expected values. We'll step through and demo several highly used assertion methods to see exactly how they work.

Video preview
Running Tests with the Test Runner
Video preview

Running Tests with the Test Runner

In this lesson, we'll learn about the various ways we can use the Ace CLI and Japa's test runner to execute all, some, or individual tests.

Video preview
Our First Test
Video preview

Our First Test

In this lesson, we'll write our first test with Japa and learn about spec files, as well as the three key components of crafting a good test: arrange, act, and assert.

Video preview
AdonisJS Testing Stack
Video preview

The AdonisJS Testing Stack

In this lesson, we'll pull down the starter project for this series and use it to discuss how Japa is integrated within AdonisJS projects.

Video preview
Why Bother Testing?
Video preview

Why Bother Testing?

In this lesson, we'll discuss what the benefits of testing are, what we should focus on when testing, and give a brief introduction to this series.

Showing 19 to 30 of 30 results