-
Notifications
You must be signed in to change notification settings - Fork 9
/
sample_contract.clj
43 lines (32 loc) · 921 Bytes
/
sample_contract.clj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
(environment :dev (fn []))
(service
(method :post)
(header "Content-Type" "application/json")
(before (fn [config]
;; Perform a POST to authenticate, for example
(add-cookie config "SESSION" (-> :cookie-jar response (get "SESSION_ID")))
))
(after (fn []))
(contract
"payment recipient list"
(definition
(url "/recipients"))
(clauses
(should_have :path "$..recipients" :of_type :array)
(should_have :path "$..recipients[*].name", :equal_to "")
(should_have :path "$.name", :matching #"\w+\w+")))
(conversation
"Creating a new send money transaction"
(contract
"create transaction"
:named submit_tx
(definition ...)
(clauses ...))
(contract
"verify transaction details"
(definition
(url "...")
(body {
:transactionid (:transaction_id submit_tx)}))
(clauses
(should_have :path "", :of_type :string)))))