Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save joshuaNjordan85/b11599f3cabffce372975b546034031b to your computer and use it in GitHub Desktop.
Save joshuaNjordan85/b11599f3cabffce372975b546034031b to your computer and use it in GitHub Desktop.
(deftest test-routing
(checking (str "that when route-to is dispatched, the view"
"routed-to is added to the view-history and"
" that when route-back is dispatched, the view"
" routed to is the previous view in the view-"
"history") 100
[routing-events (s/gen ::route-to-events)]
(reset-db!)
(run! dispatch-sync routing-events)
(let [without-last-route (pop routing-events)
view-history (get-in @re-frame.db/app-db [:wolo.db/view-history])]
(is (= (mapv second routing-events) view-history))
(fn []
(dispatch-sync [:event/route-back])
(is (= (val (last without-last-route)) view-history))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment