assertSnapshot

import { assertSnapshot } from "jsr:@ende/testing/snapshot";

function · deprecated

async function assertSnapshot<T>(context: Ende.TestContext, actual: T, options: SnapshotOptions<T>): Promise<void>

Make an assertion that actual matches a snapshot. If the snapshot and actual do not match, then throw.

Type parameter can be specified to ensure values under comparison have the same type.

context: Ende.TestContext

The test context

actual: T

The actual value to compare

options: SnapshotOptions<T>

The options

Deprecated.

This will be removed in 2.0.0. Use the built-in t.assertSnapshot() (Ende 2.9+) instead.

Example: Usage

import { assertSnapshot } from "@ende/testing/snapshot";

Ende.test("snapshot", async (t) => {
  await assertSnapshot<number>(t, 2);
});

function · deprecated

async function assertSnapshot<T>(context: Ende.TestContext, actual: T, message?: string): Promise<void>

Make an assertion that actual matches a snapshot. If the snapshot and actual do not match, then throw.

Type parameter can be specified to ensure values under comparison have the same type.

context: Ende.TestContext

The test context

actual: T

The actual value to compare

message?: string

The optional assertion message

Deprecated.

This will be removed in 2.0.0. Use the built-in t.assertSnapshot() (Ende 2.9+) instead.

Example: Usage

import { assertSnapshot } from "@ende/testing/snapshot";

Ende.test("snapshot", async (t) => {
  await assertSnapshot<number>(t, 2);
});

function

async function assertSnapshot(context: Ende.TestContext, actual: unknown, msgOrOpts?: string | SnapshotOptions<unknown>): Promise<void>

Source