Skip to content

Commit

Permalink
More client tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Olical committed Aug 30, 2024
1 parent a724889 commit 97559b0
Show file tree
Hide file tree
Showing 2 changed files with 119 additions and 7 deletions.
59 changes: 53 additions & 6 deletions fnl/conjure-spec/client_spec.fnl
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,56 @@
(client.with-filetype "fennel" #(client.current-client-module-name)))
nil))))))

; (describe "with-filetype"
; (fn []
; (it "executes a "
; (fn []
; (let [mod (client.load-module "clojure" "conjure.client.clojure.nrepl")]
; (assert.is_table mod))))))
(describe "current"
(fn []
(it "returns the fennel module when we're in a fennel file"
(fn []
(assert.same
(require :conjure.client.fennel.aniseed)
(client.with-filetype "fennel" #(client.current)))
nil))))

(describe "get"
(fn []
(it "looks up a value from the current client"
(fn []
(assert.same
(. (require :conjure.client.fennel.aniseed) :buf-suffix)
(client.with-filetype "fennel" #(client.get :buf-suffix)))
nil))))

(describe "call"
(fn []
(it "executes a function from a client"
(fn []
(assert.same
[:foo]
(client.with-filetype "sql" #(client.call :->list :foo)))
nil))))

(describe "optional-call"
(fn []
(it "executes a function from a client"
(fn []
(assert.same
[:foo]
(client.with-filetype "sql" #(client.call :->list :foo)))
nil))

(it "skips it if the function does not exist"
(fn []
(assert.same
nil
(client.with-filetype "sql" #(client.optional-call :does-not-exist :foo)))
nil))))

(describe "each-loaded-client"
(fn []
(it "runs a function for each loaded client"
(fn []
(local suffixes [])
(client.each-loaded-client
(fn []
(table.insert suffixes (client.get :buf-suffix))))
(assert.same [:.sql :.fnl] suffixes)
nil))))
67 changes: 66 additions & 1 deletion lua/conjure-spec/client_spec.lua

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 97559b0

Please sign in to comment.