Skip to content

Commit

Permalink
final touches on dual platform testing of Raom import
Browse files Browse the repository at this point in the history
  • Loading branch information
adamschmideg authored and tiensonqin committed Jan 22, 2021
1 parent b9416ac commit a9df8de
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 11 deletions.
14 changes: 14 additions & 0 deletions README.md
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion deps.edn
@@ -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"}
Expand Down Expand Up @@ -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"]}}}


2 changes: 1 addition & 1 deletion src/main/frontend/external/roam.cljc
Expand Up @@ -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"))
Expand Down
17 changes: 8 additions & 9 deletions src/test/frontend/external/roam_test.cljc
Expand Up @@ -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
(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))))))
(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)))))

0 comments on commit a9df8de

Please sign in to comment.