Skip to main content
Home
This release is 2 versions behind 0.0.22 — the latest version of @alator21/jobless-machine. Jump to latest

Test framework

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
100%
Published
3 days ago (0.0.20)
class AssertionFactory

Factory for creating multiple assertion instances from a template. Useful for repeating assertions or generating dynamic assertion collections.

Examples

Example 1

const factory = AssertionFactory.times(3, () =>
  ContextAssertion.create("user.id", (id) => id !== undefined)
);
// Creates 3 identical assertions

Constructors

new
AssertionFactory(assertions: Array<() => Assertion<Con>>)

Creates a new assertion factory.

Type Parameters

Con extends Record<string, unknown>
  • The context type containing shared state

Properties

private
readonly
_assertions: Array<() => Assertion<Con>>
readonly
assertions: Array<() => Assertion<Con>>

Gets all assertion factory functions.

Methods

Returns the type identifier for this factory.

Static Methods

times<Con2 extends Record<string, unknown>>(
count: number,
factory: () => Assertion<Con2>,
): AssertionFactory<Con2>

Creates an assertion factory that repeats an assertion multiple times.

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@alator21/jobless-machine

Import symbol

import { AssertionFactory } from "@alator21/jobless-machine";
or

Import directly with a jsr specifier

import { AssertionFactory } from "jsr:@alator21/jobless-machine";

Add Package

pnpm i jsr:@alator21/jobless-machine
or (using pnpm 10.8 or older)
pnpm dlx jsr add @alator21/jobless-machine

Import symbol

import { AssertionFactory } from "@alator21/jobless-machine";

Add Package

yarn add jsr:@alator21/jobless-machine
or (using Yarn 4.8 or older)
yarn dlx jsr add @alator21/jobless-machine

Import symbol

import { AssertionFactory } from "@alator21/jobless-machine";

Add Package

vlt install jsr:@alator21/jobless-machine

Import symbol

import { AssertionFactory } from "@alator21/jobless-machine";

Add Package

npx jsr add @alator21/jobless-machine

Import symbol

import { AssertionFactory } from "@alator21/jobless-machine";

Add Package

bunx jsr add @alator21/jobless-machine

Import symbol

import { AssertionFactory } from "@alator21/jobless-machine";