Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

test: add test for Tiny.insertMedia

thecodrr9e2efd632dfb
diff --git a/packages/core/content-types/__tests__/tiny.test.js b/packages/core/content-types/__tests__/tiny.test.js
index 8b114fcf1..81f4948df 100644
--- a/packages/core/content-types/__tests__/tiny.test.js
+++ b/packages/core/content-types/__tests__/tiny.test.js
@@ -10,3 +10,13 @@ test("img src is empty after extract attachments", async () => {
expect(result.data).not.toContain(`src="data:image/png;`);
expect(result.data).not.toContain(`src=`);
});
+
+test("img src is present after insert attachments", async () => {
+ const tiny = new Tiny(IMG_CONTENT);
+ const result = await tiny.extractAttachments(async () => {
+ return { key: "hello", metadata: {} };
+ });
+ const tiny2 = new Tiny(result.data);
+ const result2 = await tiny2.insertMedia(() => "i am a data");
+ expect(result2).toContain(`src="i am a data"`);
+});