Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/oak_nest/test_deps.ts

Refer to nestjs to realize some common functions for Deno
Go to Latest
import * as oakNest from "https://deno.land/x/oak_nest@v1.14.2/test_deps.ts";

Namespaces

A collection of utility APIs which can make testing of an oak application easier.

Classes

A class which registers middleware (via .use()) and then processes inbound requests against that middleware (via .listen()).

Provides context about the current request and response to middleware functions, and the current instance being processed is the first argument provided a Middleware function.

An interface which allows setting and accessing cookies related to both the current request and response. Each Context has a property .cookies which is an instance of this class.

An interface for registering middleware that will run when certain HTTP methods and paths are requested, as well as provides a way to parameterize parts of the requested path.

An interface which provides information about the current request. The instance related to the current request is available on the Context's .request property.

An interface to control what response will be sent when the middleware finishes processing the request.

Enums

Standard HTTP status codes.

Variables

Allows external parties to modify the context state.

Functions

Make an assertion, error will be thrown if expr does not have truthy value.

Make an assertion that actual and expected are equal, deeply. If not deeply equal, then throw.

Make an assertion that error is an Error. If not then an error will be thrown. An error class and a string that should be included in the error message can also be asserted.

Executes a function which returns a promise, expecting it to throw or reject. If it does not, then it throws. An error class and a string that should be included in the error message can also be asserted. Or you can pass a callback which will be passed the error, usually to apply some custom assertions on it.

Checks if a given value is an enum

A type guard that determines if the value is an HttpError or not.

Checks if a value is a number.

Checks if value is missing and if so, ignores all validators.

Checks if a given value is a real string.

Checks if the first number is less than or equal to the second.

Checks if the first number is greater than or equal to the second.

Asynchronously fulfill a response with a file from the local file system.

Creates a mock of Application.

Create a mock of Context or RouterContext.

Creates a mock next() function which can be used when calling middleware.

Validates given object and reject on error.

Interfaces

Middleware are functions which are chained together to deal with requests.

Options that can be set in a mock context.