final touches on dual platform testing of Raom import

pull/1181/head
Adam Schmideg 2021-01-21 16:19:42 +01:00 committed by Tienson Qin
parent b9416ac989
commit a9df8deaae
4 changed files with 28 additions and 11 deletions

View File

@ -89,6 +89,20 @@ Open <http://localhost:3001>.
yarn release
```
### 5. Run tests
Run ClojureScript tests
```bash
yarn
yarn cljs:test
node static/tests.js
```
Run Clojure tests. (Note: `.cljc` files may be tested both by ClojureScript, and Clojure.)
```bash
clj -Mtest-clj
```
## Alternative: Docker based development environment
### 1. Fetch sources

View File

@ -1,6 +1,7 @@
{:paths ["src/main"]
:deps
{org.clojure/clojure {:mvn/version "1.10.0"}
cheshire/cheshire {:mvn/version "5.10.0"}
rum/rum {:mvn/version "0.12.3"}
;; rum {:local/root "/home/tienson/codes/source/clj/rum"}
;; persistent-sorted-set {:mvn/version "0.1.2"}
@ -44,11 +45,14 @@
org.clojure/clojurescript {:mvn/version "1.10.764"}
org.clojure/test.check {:mvn/version "RELEASE"}}
:main-opts ["-m" "shadow.cljs.devtools.cli"]}
:test-clj
{:extra-paths ["src/test/"]
:extra-deps
{cheshire/cheshire {:mvn/version "5.10.0"}
{
com.cognitect/test-runner
{:git/url "https://github.com/cognitect-labs/test-runner",
:sha "76568540e7f40268ad2b646110f237a60295fa3c"}},
:main-opts ["-m" "cognitect.test-runner" "-d" "src/test"]}}}

View File

@ -128,7 +128,7 @@
(defrecord Roam []
protocol/External
(toMarkdownFiles [this content _config]
(->files content)))
(-> content json->edn ->files)))
(comment
(defonce test-roam-json (frontend.db/get-file "same.json"))

View File

@ -26,12 +26,11 @@
(deftest json->edn-test
(is (= [1 {:foo 42, :bar "baz"} 3] (roam/json->edn "[1, {\"foo\": 42, \"bar\": \"baz\"}, 3]"))))
(comment
(deftest roam-import-test
(deftest roam-import-test
(let [got (to-markdown-files :roam minimal-json {})
md (first got)]
(is (= 1 (count got)))
(is (= "Export JSON" (:title md)))
(is (:created-at md))
(is (:last-modified-at md))
(is (= "---\ntitle: Export JSON\n---\n\n## Hello, world!\n" (:text md))))))
(is (= "---\ntitle: Export JSON\n---\n\n## Hello, world!\n" (:text md)))))