Skip to content

Commit b75318c

Browse files
committed
Convert to integrant and implement user resolver tests.
1 parent 20b7a91 commit b75318c

File tree

19 files changed

+272
-113
lines changed

19 files changed

+272
-113
lines changed

.dir-locals.el

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
((nil . ((fill-column . 70)
2-
(column-enforce-column . 70))))
2+
(column-enforce-column . 70)
3+
(cider-default-cljs-repl . shadow)
4+
(cider-shadow-default-options . ":dev")
5+
(cider-shadow-cljs-global-options . "-A:dev:test"))))

Makefile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
.PHONY: test test-up test-down
2+
3+
test:
4+
POSTGRES_PORT=15433 docker-compose -p mygiftlist-blog-test up -d
5+
scripts/migrate-local.sh mygiftlist-blog-test_default
6+
clojure -A:test:run-tests
7+
docker-compose -p mygiftlist-blog-test down
8+
9+
test-up:
10+
POSTGRES_PORT=15433 docker-compose -p mygiftlist-blog-test up -d
11+
scripts/migrate-local.sh mygiftlist-blog-test_default
12+
13+
test-down:
14+
docker-compose -p mygiftlist-blog-test down

README.md

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,26 @@ There's also a convenience script available at `./scripts/psql` to open up a psq
3636

3737
To run this application in development mode, start a shadow-cljs server with
3838
```bash
39-
npx shadow-cljs -d nrepl:0.7.0 -d cider/piggieback:0.4.2 -d refactor-nrepl:2.5.0 -d cider/cider-nrepl:0.25.0-SNAPSHOT server
39+
npx shadow-cljs -A:dev:test -d nrepl:0.7.0 -d cider/piggieback:0.4.2 -d refactor-nrepl:2.5.0 -d cider/cider-nrepl:0.25.0-SNAPSHOT server
4040
```
4141

42-
With this running, you can control compilation by accessing the shadow-cljs server at http://localhost:9630. In addition, this command will start up an nrepl server, which you should connect to with your preferred REPL. Alternatively, CIDER users can run `cider-jack-in-clj&cljs`.
42+
With this running, you can control compilation by accessing the shadow-cljs server at http://localhost:9630. In addition, this command will start up an nrepl server, which you should connect to with your preferred REPL. Alternatively, CIDER users can run `cider-jack-in-clj&cljs` and choose `shadow-cljs`.
4343

44-
In your clojure repl, make sure you are in the `user` namespace and evaluate `(start)`. This will start our web server. With the web server running, you can access the application at http://localhost:3000.
44+
In your clojure repl, make sure you are in the `user` namespace and evaluate `(go)`. This will start our web server. With the web server running, you can access the application at http://localhost:3000.
45+
46+
## Tests
47+
48+
To run the test suite from the command line, run
49+
```bash
50+
make test
51+
```
52+
53+
In order to run tests from the repl, you need to start up the test database. You can do this with
54+
```bash
55+
make test-up
56+
```
57+
58+
With the test database up and running, you should be able to run tests. You can shut down the test database with
59+
```bash
60+
make test-down
61+
```

deps.edn

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,35 @@
11
{:paths ["src" "resources"]
2-
:deps {com.fulcrologic/fulcro {:mvn/version "3.1.22"}
2+
:deps {com.fulcrologic/fulcro {:mvn/version "3.2.0"}
33
com.wsscode/pathom {:mvn/version "2.2.31"}
44
edn-query-language/eql {:mvn/version "0.0.9"}
55
com.taoensso/timbre {:mvn/version "4.10.0"}
66
com.cognitect/transit-clj {:mvn/version "1.0.324"}
77
ring/ring-core {:mvn/version "1.8.0"}
88
ring/ring-defaults {:mvn/version "0.3.2"}
99
bk/ring-gzip {:mvn/version "0.3.0"}
10-
mount {:mvn/version "0.1.16"}
10+
integrant {:mvn/version "0.8.0"}
1111
seancorfield/next.jdbc {:mvn/version "1.0.409"}
1212
honeysql {:mvn/version "0.9.10"}
1313
nilenso/honeysql-postgres {:mvn/version "0.2.6"}
14-
org.postgresql/postgresql {:mvn/version "42.2.11"}
14+
org.postgresql/postgresql {:mvn/version "42.2.12"}
1515
hikari-cp {:mvn/version "2.11.0"}
1616
aero {:mvn/version "1.1.6"}
1717
http-kit {:mvn/version "2.4.0-alpha6"}}
1818
:aliases {:dev {:extra-paths ["dev"]
1919
:jvm-opts ["-Dtrace"]
20-
:extra-deps {org.clojure/tools.namespace {:mvn/version "0.3.1"}
20+
:extra-deps {org.clojure/tools.namespace {:mvn/version "1.0.0"}
2121
org.clojure/clojurescript {:mvn/version "1.10.597"}
2222
com.fulcrologic/semantic-ui-wrapper {:mvn/version "1.0.0"}
23-
org.clojure/core.async {:mvn/version "1.0.567"}
23+
org.clojure/core.async {:mvn/version "1.1.587"}
2424
com.cognitect/transit-cljs {:mvn/version "0.8.256"}
25-
com.wsscode/async {:mvn/version "1.0.2"}
25+
com.wsscode/async {:mvn/version "1.0.3"}
2626
clj-commons/pushy {:mvn/version "0.3.10"}
27-
thheller/shadow-cljs {:mvn/version "2.8.83"}
28-
binaryage/devtools {:mvn/version "0.9.10"}}}
27+
thheller/shadow-cljs {:mvn/version "2.8.94"}
28+
binaryage/devtools {:mvn/version "1.0.0"}
29+
integrant/repl {:mvn/version "0.3.1"}}}
30+
:test {:extra-paths ["test"]
31+
:extra-deps {com.cognitect/test-runner {:git/url "https://github.com/cognitect-labs/test-runner.git"
32+
:sha "209b64504cb3bd3b99ecfec7937b358a879f55c1"}}}
33+
:run-tests {:main-opts ["-m" "cognitect.test-runner"]}
2934
:outdated {:extra-deps {olical/depot {:mvn/version "1.8.4"}}
3035
:main-opts ["-m" "depot.outdated.main"]}}}

dev/resources/dev.edn

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{:rocks.mygiftlist.config/config {:rocks.mygiftlist.config/profile :dev}}

dev/resources/test.edn

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{:rocks.mygiftlist.config/config {:rocks.mygiftlist.config/profile :test}}

dev/user.clj

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,23 @@
11
(ns user
22
(:require
33
rocks.mygiftlist.server
4-
[clojure.tools.namespace.repl :as tools-ns :refer [set-refresh-dirs]]
5-
[mount.core :as mount]))
4+
rocks.mygiftlist.parser
5+
rocks.mygiftlist.db
6+
rocks.mygiftlist.config
7+
[integrant.core :as ig]
8+
[integrant.repl :refer [clear go halt prep init reset reset-all]]
9+
[integrant.repl.state :refer [system]]
10+
[clojure.java.io :as io]))
611

7-
;; ==================== REPL TOOLING ====================
12+
(integrant.repl/set-prep!
13+
(fn []
14+
(merge
15+
(ig/read-string (slurp (io/resource "system.edn")))
16+
(ig/read-string (slurp (io/resource "resources/dev.edn"))))))
817

9-
(set-refresh-dirs "src" "dev")
10-
11-
(defn start
12-
"Start the web server"
13-
[] (mount/start))
14-
15-
(defn stop
16-
"Stop the web server"
17-
[] (mount/stop))
18-
19-
(defn restart
20-
"Stop, reload code, and restart the server. If there is a compile error, use:
21-
```
22-
(tools-ns/refresh)
23-
```
24-
to recompile, and then use `start` once things are good."
25-
[]
26-
(stop)
27-
(tools-ns/refresh :after 'user/start))
18+
(comment
19+
system
20+
(go)
21+
(reset)
22+
(halt)
23+
)

docker-compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ services:
66
environment:
77
POSTGRES_PASSWORD: password
88
ports:
9-
- "15432:5432"
9+
- "${POSTGRES_PORT:-15432}:5432"
1010
volumes:
1111
- db_data:/var/lib/postgresql/data
1212
volumes:

package-lock.json

Lines changed: 23 additions & 47 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@
44
"description": "",
55
"private": true,
66
"devDependencies": {
7-
"@auth0/auth0-spa-js": "^1.6.4",
8-
"minimist": "^1.2.2",
9-
"react": "^16.13.0",
10-
"react-dom": "^16.13.0",
7+
"@auth0/auth0-spa-js": "^1.6.5",
8+
"react": "^16.13.1",
9+
"react-dom": "^16.13.1",
1110
"semantic-ui-react": "^0.88.2",
12-
"shadow-cljs": "^2.8.83"
11+
"shadow-cljs": "^2.8.94"
1312
},
1413
"author": "Chris O'Donnell",
1514
"license": "MIT"

0 commit comments

Comments
 (0)