Skip to content

Commit

Permalink
add component tests
Browse files Browse the repository at this point in the history
  • Loading branch information
briansztamfater committed Jul 28, 2023
1 parent 19536c8 commit 9c5a14a
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
19 changes: 19 additions & 0 deletions src/quo2/components/graph/wallet_graph/component_spec.cljs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
(ns quo2.components.graph.wallet-graph.component-spec
(:require [test-helpers.component :as h]
[quo2.components.graph.wallet-graph.view :as wallet-graph]))

(defn data
[num-elements]
(vec (take num-elements (repeat {:value 10}))))

(h/describe "wallet-graph"
(h/test "render empty wallet graph"
(h/render [wallet-graph/wallet-graph
{:time-frame :empty}])
(h/is-truthy (h/get-by-label-text :illustration)))

(h/test "render 1 week wallet graph"
(h/render [wallet-graph/wallet-graph
{:time-frame :1-week
:data (data 7)}])
(h/is-truthy (h/get-by-label-text :line-chart))))
7 changes: 5 additions & 2 deletions src/quo2/components/graph/wallet_graph/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,13 @@
:end {:x 0 :y 0}
:style style/gradient-background}
(if (= time-frame :empty)
[rn/view {:style style/illustration}
[rn/view
{:accessibility-label :illustration
:style style/illustration}
[text/text "Illustration here"]]
[charts/line-chart
{:height 96
{:accessibility-label :line-chart
:height 96
:width (+ width 1)
:max-value max-value
:min-value 0
Expand Down
1 change: 1 addition & 0 deletions src/quo2/core_spec.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
[quo2.components.drawers.documentation-drawers.component-spec]
[quo2.components.drawers.drawer-buttons.component-spec]
[quo2.components.drawers.permission-context.component-spec]
[quo2.components.graph.wallet-graph.component-spec]
[quo2.components.inputs.input.component-spec]
[quo2.components.inputs.profile-input.component-spec]
[quo2.components.inputs.recovery-phrase.component-spec]
Expand Down

0 comments on commit 9c5a14a

Please sign in to comment.