Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/hex/src/lib/stdx/testing.ts>snapshot.assertSnapshot

An ecosystem delivering practices, philosophy and portability. Powered By Deno and JavaScript.
Latest
function snapshot.assertSnapshot
import { snapshot } from "https://deno.land/x/hex@0.6.5/src/lib/stdx/testing.ts";
const { assertSnapshot } = snapshot;

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

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

Examples

Example 1

import { assertSnapshot } from "https://deno.land/std@0.224.0/testing/snapshot.ts";

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

Returns

Promise<void>

Parameters

actual: T
optional
message: string

Returns

Promise<void>