diff --git a/apps/server/src/routes/api/clipper.spec.ts b/apps/server/src/routes/api/clipper.spec.ts index 1efa6915e..17b43f3b9 100644 --- a/apps/server/src/routes/api/clipper.spec.ts +++ b/apps/server/src/routes/api/clipper.spec.ts @@ -1,4 +1,5 @@ import { BNote } from "../../services/backend_script_entrypoint"; +import cls from "../../services/cls"; import { buildNote } from "../../test/becca_easy_mocking"; import { processContent } from "./clipper"; @@ -6,7 +7,9 @@ let note!: BNote; describe("processContent", () => { beforeAll(() => { - note = buildNote({}); + note = buildNote({ + content: "Hi there" + }); note.saveAttachment = () => {}; vi.mock("../../services/image.js", () => ({ default: { @@ -21,29 +24,29 @@ describe("processContent", () => { }); it("processes basic note", () => { - const processed = processContent([], note, "
Hello world.
"); + const processed = cls.init(() => processContent([], note, "Hello world.
")); expect(processed).toStrictEqual("Hello world.
") }); it("processes plain text", () => { - const processed = processContent([], note, "Hello world."); + const processed = cls.init(() => processContent([], note, "Hello world.")); expect(processed).toStrictEqual("Hello world.
") }); it("replaces images", () => { - const processed = processContent( + const processed = cls.init(() => processContent( [{"imageId":"OKZxZA3MonZJkwFcEhId","src":"inline.png","dataUrl":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAQCAYAAADESFVDAAAAF0lEQVQoU2P8DwQMBADjqKLRIGAgKggAzHs/0SoYCGwAAAAASUVORK5CYII="}], note, `