mirror of
https://github.com/status-im/pluto.git
synced 2025-02-24 16:38:16 +00:00
Added some more tests
This commit is contained in:
parent
fce996a8ab
commit
acd444435b
@ -14,6 +14,7 @@
|
|||||||
::invalid-assoc-type
|
::invalid-assoc-type
|
||||||
::invalid-reference
|
::invalid-reference
|
||||||
::invalid-destructuring-format
|
::invalid-destructuring-format
|
||||||
|
::missing-property
|
||||||
::missing-keys
|
::missing-keys
|
||||||
::unknown-reference
|
::unknown-reference
|
||||||
::unknown-reference-type
|
::unknown-reference-type
|
||||||
|
@ -64,7 +64,7 @@
|
|||||||
errors))
|
errors))
|
||||||
(if optional?
|
(if optional?
|
||||||
(update m :data #(if (empty? %) {} %))
|
(update m :data #(if (empty? %) {} %))
|
||||||
(assoc m :errors [(errors/error ::errors/invalid-type-name name)]))))
|
(assoc m :errors [(errors/error ::errors/missing-property name)]))))
|
||||||
|
|
||||||
(defmethod resolve :assoc [ctx ext type value]
|
(defmethod resolve :assoc [ctx ext type value]
|
||||||
(if (map? type)
|
(if (map? type)
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
(let [app-hooks (hooks {:name :string :id :keyword})]
|
(let [app-hooks (hooks {:name :string :id :keyword})]
|
||||||
(is (= {:data {:hooks {:main {:a {:parsed {:name "name"}
|
(is (= {:data {:hooks {:main {:a {:parsed {:name "name"}
|
||||||
:hook-ref (:main app-hooks)}}}}
|
:hook-ref (:main app-hooks)}}}}
|
||||||
:errors [{::errors/type ::errors/invalid-type-name
|
:errors [{::errors/type ::errors/missing-property
|
||||||
::errors/value :id}]}
|
::errors/value :id}]}
|
||||||
(hooks/parse {:capacities {:hooks app-hooks}}
|
(hooks/parse {:capacities {:hooks app-hooks}}
|
||||||
{'hooks/main.a {:name "name"}}))))
|
{'hooks/main.a {:name "name"}}))))
|
||||||
|
@ -81,6 +81,17 @@
|
|||||||
(is (= {:data {:scopes [{:scope :one}]}}
|
(is (= {:data {:scopes [{:scope :one}]}}
|
||||||
(types/resolve {} {} {:scopes [{:scope {:one-of #{:one :two :three}}}]}
|
(types/resolve {} {} {:scopes [{:scope {:one-of #{:one :two :three}}}]}
|
||||||
{:scopes [{:scope :one}]})))
|
{:scopes [{:scope :one}]})))
|
||||||
|
(is (= {:data {:students [{:firstname "John" :lastname "Doe"}]}}
|
||||||
|
(types/resolve {} {} {:students [{:firstname :string :lastname :string :name? :string}]}
|
||||||
|
{:students [{:firstname "John" :lastname "Doe"}]})))
|
||||||
|
(is (= '[text nil]
|
||||||
|
(let [m (types/resolve {} '{views/screen [text]} {:screen :view :students [{:firstname :string :lastname :string :name? :string}]}
|
||||||
|
{:screen ['screen] :students [{:firstname "John" :lastname "Doe"}]})]
|
||||||
|
((get-in m [:data :screen]) {}))))
|
||||||
|
(is (= '[text nil]
|
||||||
|
(let [m (types/resolve {} '{views/screen [text]} {:screen? :view :students [{:firstname :string :lastname :string :name? :string}]}
|
||||||
|
{:screen ['screen] :students [{:firstname "John" :lastname "Doe" :name "Henry"}]})]
|
||||||
|
((get-in m [:data :screen]) {}))))
|
||||||
(is (= {:data {:name "hello"
|
(is (= {:data {:name "hello"
|
||||||
:children [{:name "name" :scopes [{:scope :one}]}
|
:children [{:name "name" :scopes [{:scope :one}]}
|
||||||
{:name "name" :scopes [{:scope :two}]}]}}
|
{:name "name" :scopes [{:scope :two}]}]}}
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
const ipfs = new window.Ipfs();
|
const ipfs = new window.Ipfs();
|
||||||
|
|
||||||
async function load() {
|
async function load() {
|
||||||
const buffer = await loadIPFS(ipfs, "QmSQnPcpzuk9ij9Vq5crEUNomBvHn8CB99j7gcCtfF2UdJ");
|
const buffer = await loadIPFS(ipfs, "QmVkhWzxTM9kmZANcUnzrfrzN5qg3Qh7GqZDQtX1E1JPE4");
|
||||||
return buffer.toString();
|
return buffer.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user