mirror of
https://github.com/zadam/trilium.git
synced 2025-10-21 07:38:53 +02:00
test(server/share): basic text rendering check
This commit is contained in:
parent
3f8f05368c
commit
804fc72ed8
@ -1,7 +1,31 @@
|
|||||||
import { describe, it, expect } from "vitest";
|
import { describe, it, expect } from "vitest";
|
||||||
import { renderCode, type Result } from "./content_renderer.js";
|
import { renderCode, renderText, type Result } from "./content_renderer.js";
|
||||||
|
import { trimIndentation } from "@triliumnext/commons";
|
||||||
|
import SNote from "./shaca/entities/snote.js";
|
||||||
|
|
||||||
describe("content_renderer", () => {
|
describe("content_renderer", () => {
|
||||||
|
describe("renderText", () => {
|
||||||
|
it("parses simple note", () => {
|
||||||
|
const input = trimIndentation`\
|
||||||
|
<figure class="image image-style-align-right image_resized" style="width:29.84%;">
|
||||||
|
<img style="aspect-ratio:150/150;" src="api/attachments/TnyuBzEXJZln/image/Trilium Demo_icon-color.svg" width="150" height="150">
|
||||||
|
</figure>
|
||||||
|
<p>
|
||||||
|
<strong>
|
||||||
|
Welcome to Trilium Notes!
|
||||||
|
</strong>
|
||||||
|
</p>`;
|
||||||
|
|
||||||
|
const result = {
|
||||||
|
content: input,
|
||||||
|
header: "",
|
||||||
|
isEmpty: false
|
||||||
|
};
|
||||||
|
renderText(result, new SNote([ "root", "Note", "text", "text/plain", "1234", "2025-09-28T00:00Z", false]));
|
||||||
|
expect(result.content).toMatch(input);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe("renderCode", () => {
|
describe("renderCode", () => {
|
||||||
it("identifies empty content", () => {
|
it("identifies empty content", () => {
|
||||||
const emptyResult: Result = {
|
const emptyResult: Result = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user