Updated devtools

This commit is contained in:
Michaël Lemaire 2020-12-02 22:02:57 +01:00
parent 63751d9696
commit 69a4825f5a

View file

@ -1,8 +1,8 @@
import {
it,
expect,
patch,
} from "https://code.thunderk.net/typescript/devtools/raw/1.0.0/testing.ts";
it,
mock,
} from "https://code.thunderk.net/typescript/devtools/raw/1.2.2/testing.ts";
import { Serializer } from "./serializer.ts";
class TestSerializerObj1 {
@ -162,13 +162,12 @@ it("calls specific postUnserialize", () => {
});
it("handles missing classes", () => {
const mock_error = patch(console, "error", () => {});
let serializer = new Serializer(TEST_NS);
mock_error.exec(() => {
mock(console, "error", undefined, (mock_error) => {
let serializer = new Serializer(TEST_NS);
let data = serializer.serialize({ obj: new TestSerializerObj4() });
let loaded = serializer.unserialize(data);
expect(loaded).toEqual({ obj: { a: 0 } });
expect(mock_error.fn).toHaveBeenCalledWith(
expect(mock_error).toHaveBeenCalledWith(
"Can't find class",
"TestSerializerObj4",
);