Skip to content

Commit

Permalink
Add failing test case
Browse files Browse the repository at this point in the history
  • Loading branch information
marcobiscaro2112 committed Dec 7, 2024
1 parent fdb3fac commit 12e57f1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
; Must be provided by the user (typically only used in tests)
[http-kit.fake "0.2.2" :scope "provided"]
[nubank/state-flow "5.18.0" :scope "provided"]
[dev.nubank/clj-github-mock "0.3.0" :scope "provided"]]
[dev.nubank/clj-github-mock "0.4.0" :scope "provided"]]

:cljfmt {:indents {flow [[:block 1]]
assoc-some [[:block 0]]}}
Expand Down
16 changes: 14 additions & 2 deletions test/clj_github/changeset_test.clj
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
(ns clj-github.changeset-test
(:require [clojure.test :refer :all]
[clj-github-mock.core :as mock.core]
(:require [clj-github-mock.core :as mock.core]
[clj-github.changeset :as sut]
[clj-github.httpkit-client :as client]
[clojure.test :refer :all]
[org.httpkit.fake :as fake]))

(defmacro with-client [[client initial-state] & body]
Expand All @@ -14,6 +14,9 @@
(def initial-state {:orgs [{:name "nubank" :repos [{:name "repo"
:default_branch "master"}]}]})

(def string-content-with-special-chars
"This is a string with special characters: \uD83C\uDF89\uD83C\uDF89\uD83C\uDF89\uD83D\uDD25\uD83D\uDD25\uD83D\uDD25")

(deftest get-content-test
(testing "get content from client if there is no change"
(with-client [client initial-state]
Expand All @@ -24,6 +27,15 @@
(let [revision (sut/from-branch! client "nubank" "repo" "master")]
(is (= "content"
(sut/get-content revision "file"))))))
(testing "get string content with special characters"
(with-client [client initial-state]
(-> (sut/orphan client "nubank" "repo")
(sut/put-content "file" string-content-with-special-chars)
(sut/commit! "initial commit")
(sut/create-branch! "master"))
(let [revision (sut/from-branch! client "nubank" "repo" "master")]
(is (= string-content-with-special-chars
(sut/get-content revision "file"))))))
(testing "get changed content"
(with-client [client initial-state]
(-> (sut/orphan client "nubank" "repo")
Expand Down

0 comments on commit 12e57f1

Please sign in to comment.