std/expect/_serializer_test.ts
eryue0220 e7c6d36abf
fix(expect): support expect.addSnapshotSerializer (#6173)
Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
2024-11-06 12:51:50 +09:00

24 lines
532 B
TypeScript

// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
import { expect } from "./expect.ts";
import { addSerializer, getSerializer } from "./_serializer.ts";
import type { SnapshotPlugin } from "./_types.ts";
const foo: SnapshotPlugin = {
serialize() {
return "foot";
},
test() {
return false;
},
};
Deno.test("initial serializer", () => {
expect(getSerializer()).toHaveLength(0);
});
Deno.test("add serializer", () => {
addSerializer(foo);
expect(getSerializer()).toHaveLength(1);
});