Starting to get the project set up. Nothing is even nearly complete yet.
This commit is contained in:
commit
b6a24bc1ce
59 changed files with 7118 additions and 0 deletions
7
test/clj/features/index_page.feature
Normal file
7
test/clj/features/index_page.feature
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
Feature: Cukes
|
||||
An example of testing a compojure app with cucumber.
|
||||
|
||||
Scenario: Index Page
|
||||
Given I am at the "homepage"
|
||||
Then I should see "Welcome to youyesyet"
|
||||
|
||||
11
test/clj/features/step_definitions/home_page_steps.clj
Normal file
11
test/clj/features/step_definitions/home_page_steps.clj
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
(require '[clj-webdriver.taxi :as taxi]
|
||||
'[youyesyet.browser :refer [browser-up browser-down]]
|
||||
'[clojure.test :refer :all])
|
||||
|
||||
(Given #"^I am at the \"homepage\"$" []
|
||||
(browser-up)
|
||||
(taxi/to "http://localhost:3000/"))
|
||||
|
||||
(Then #"^I should see \"([^\"]*)\"$" [title]
|
||||
(is (= (taxi/text "div.jumbotron > h1") title))
|
||||
(browser-down))
|
||||
17
test/clj/youyesyet/browser.clj
Normal file
17
test/clj/youyesyet/browser.clj
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
(ns youyesyet.browser
|
||||
(:require [clj-webdriver.taxi :refer :all]))
|
||||
|
||||
(def ^:private browser-count (atom 0))
|
||||
|
||||
(defn browser-up
|
||||
"Start up a browser if it's not already started."
|
||||
[]
|
||||
(when (= 1 (swap! browser-count inc))
|
||||
(set-driver! {:browser :firefox})
|
||||
(implicit-wait 60000)))
|
||||
|
||||
(defn browser-down
|
||||
"If this is the last request, shut the browser down."
|
||||
[& {:keys [force] :or {force false}}]
|
||||
(when (zero? (swap! browser-count (if force (constantly 0) dec)))
|
||||
(quit)))
|
||||
36
test/clj/youyesyet/test/db/core.clj
Normal file
36
test/clj/youyesyet/test/db/core.clj
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
(ns youyesyet.test.db.core
|
||||
(:require [youyesyet.db.core :refer [*db*] :as db]
|
||||
[luminus-migrations.core :as migrations]
|
||||
[clojure.test :refer :all]
|
||||
[clojure.java.jdbc :as jdbc]
|
||||
[youyesyet.config :refer [env]]
|
||||
[mount.core :as mount]))
|
||||
|
||||
(use-fixtures
|
||||
:once
|
||||
(fn [f]
|
||||
(mount/start
|
||||
#'youyesyet.config/env
|
||||
#'youyesyet.db.core/*db*)
|
||||
(migrations/migrate ["migrate"] (select-keys env [:database-url]))
|
||||
(f)))
|
||||
|
||||
(deftest test-users
|
||||
(jdbc/with-db-transaction [t-conn *db*]
|
||||
(jdbc/db-set-rollback-only! t-conn)
|
||||
(is (= 1 (db/create-user!
|
||||
t-conn
|
||||
{:id "1"
|
||||
:first_name "Sam"
|
||||
:last_name "Smith"
|
||||
:email "sam.smith@example.com"
|
||||
:pass "pass"})))
|
||||
(is (= {:id "1"
|
||||
:first_name "Sam"
|
||||
:last_name "Smith"
|
||||
:email "sam.smith@example.com"
|
||||
:pass "pass"
|
||||
:admin nil
|
||||
:last_login nil
|
||||
:is_active nil}
|
||||
(db/get-user t-conn {:id "1"})))))
|
||||
13
test/clj/youyesyet/test/handler.clj
Normal file
13
test/clj/youyesyet/test/handler.clj
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
(ns youyesyet.test.handler
|
||||
(:require [clojure.test :refer :all]
|
||||
[ring.mock.request :refer :all]
|
||||
[youyesyet.handler :refer :all]))
|
||||
|
||||
(deftest test-app
|
||||
(testing "main route"
|
||||
(let [response (app (request :get "/"))]
|
||||
(is (= 200 (:status response)))))
|
||||
|
||||
(testing "not-found route"
|
||||
(let [response (app (request :get "/invalid"))]
|
||||
(is (= 404 (:status response))))))
|
||||
8
test/cljs/youyesyet/core_test.cljs
Normal file
8
test/cljs/youyesyet/core_test.cljs
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
(ns youyesyet.core-test
|
||||
(:require [cljs.test :refer-macros [is are deftest testing use-fixtures]]
|
||||
[reagent.core :as reagent :refer [atom]]
|
||||
[youyesyet.core :as rc]))
|
||||
|
||||
(deftest test-home
|
||||
(is (= true true)))
|
||||
|
||||
6
test/cljs/youyesyet/doo_runner.cljs
Normal file
6
test/cljs/youyesyet/doo_runner.cljs
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
(ns youyesyet.doo-runner
|
||||
(:require [doo.runner :refer-macros [doo-tests]]
|
||||
[youyesyet.core-test]))
|
||||
|
||||
(doo-tests 'youyesyet.core-test)
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue