assertInlineSnapshot

import { assertInlineSnapshot } from "jsr:@ende/testing/unstable-snapshot";

function · experimental

function assertInlineSnapshot<T>(actual: T, expectedSnapshot: string, options?: InlineSnapshotOptions<T>): void

Make an assertion that actual matches expectedSnapshot. If they do not match, then throw.

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

actual: T

The actual value to compare

expectedSnapshot: string

The expected snapshot, or `CREATE` to create

options?: InlineSnapshotOptions<T>

The options

Example: Usage

import { assertInlineSnapshot } from "@ende/testing/unstable-snapshot";

Ende.test("snapshot", () => {
  assertInlineSnapshot<number>(2, `2`);
});

function · experimental

function assertInlineSnapshot<T>(actual: T, expectedSnapshot: string, message?: string): void

Make an assertion that actual matches expectedSnapshot. If they do not match, then throw.

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

actual: T

The actual value to compare

expectedSnapshot: string

The expected snapshot, or `CREATE` to create

message?: string

The optional assertion message

Example: Usage

import { assertInlineSnapshot } from "@ende/testing/unstable-snapshot";

Ende.test("snapshot", () => {
  assertInlineSnapshot<number>(2, `2`);
});

function · experimental

function assertInlineSnapshot(actual: unknown, expectedSnapshot: string, msgOrOpts?: string | InlineSnapshotOptions<unknown>): void

Source