(ns frontend.handler.export-test (:require [cljs.test :refer [are async deftest use-fixtures]] [clojure.string :as string] [frontend.handler.export.text :as export-text] [frontend.state :as state] [frontend.test.helper :as test-helper :include-macros true :refer [deftest-async]] [promesa.core :as p])) (def test-files [{:file/path "pages/page1.md" :file/content (string/trim " - 1 id:: 61506710-484c-46d5-9983-3d1651ec02c8 - 2 id:: 61506711-5638-4899-ad78-187bdc2eaffc - 3 id:: 61506712-3007-407e-b6d3-d008a8dfa88b - ((61506712-3007-407e-b6d3-d008a8dfa88b)) - 4 id:: 61506712-b8a7-491d-ad84-b71651c3fdab")} {:file/path "pages/page2.md" :file/content (string/trim " - 3 id:: 97a00e55-48c3-48d8-b9ca-417b16e3a616 - {{embed [[page1]]}}")}]) (use-fixtures :once {:before (fn [] (async done (test-helper/start-test-db!) (p/let [_ (test-helper/load-test-files test-files)] (done)))) :after test-helper/destroy-test-db!}) (deftest export-blocks-as-markdown-without-properties (are [expect block-uuid-s] (= expect (string/trim (export-text/export-blocks-as-markdown (state/get-current-repo) [(uuid block-uuid-s)] {:remove-options #{:property}}))) (string/trim " - 1 - 2 - 3 - 3") "61506710-484c-46d5-9983-3d1651ec02c8" (string/trim " - 3 - 1 - 2 - 3 - 3 - 4") "97a00e55-48c3-48d8-b9ca-417b16e3a616")) (deftest export-blocks-as-markdown-with-properties (are [expect block-uuid-s] (= expect (string/trim (export-text/export-blocks-as-markdown (state/get-current-repo) [(uuid block-uuid-s)] {}))) (string/trim " - 1 id:: 61506710-484c-46d5-9983-3d1651ec02c8 - 2 id:: 61506711-5638-4899-ad78-187bdc2eaffc - 3 id:: 61506712-3007-407e-b6d3-d008a8dfa88b - 3") "61506710-484c-46d5-9983-3d1651ec02c8" (string/trim " - 3 id:: 97a00e55-48c3-48d8-b9ca-417b16e3a616 - 1 id:: 61506710-484c-46d5-9983-3d1651ec02c8 - 2 id:: 61506711-5638-4899-ad78-187bdc2eaffc - 3 id:: 61506712-3007-407e-b6d3-d008a8dfa88b - 3 - 4 id:: 61506712-b8a7-491d-ad84-b71651c3fdab") "97a00e55-48c3-48d8-b9ca-417b16e3a616")) (deftest export-blocks-as-markdown-level