mirror of
https://github.com/logseq/logseq.git
synced 2026-04-24 14:14:55 +00:00
Add enum to properties test graph
Also test classes with schema script for now
This commit is contained in:
8
.github/workflows/build.yml
vendored
8
.github/workflows/build.yml
vendored
@@ -158,11 +158,15 @@ jobs:
|
||||
- name: Create DB graph with properties
|
||||
run: cd scripts && yarn nbb-logseq src/logseq/tasks/db_graph/create_graph_with_properties.cljs ./db-graph-with-props
|
||||
|
||||
# TODO: Use a smaller, test-focused graph to test classes
|
||||
- name: Create DB graph with classes
|
||||
run: cd scripts && yarn nbb-logseq src/logseq/tasks/db_graph/create_graph_with_schema_org.cljs ./db-graph-with-schema
|
||||
|
||||
- name: Fetch deps/db yarn deps
|
||||
run: cd deps/db && yarn install --frozen-lockfile
|
||||
|
||||
- name: Validate created DB graph
|
||||
run: cd deps/db && yarn nbb-logseq script/validate_client_db.cljs ../../scripts/db-graph-with-props --closed-maps --group-errors
|
||||
- name: Validate created DB graphs
|
||||
run: cd deps/db && yarn nbb-logseq script/validate_client_db.cljs ../../scripts/db-graph-with-props ../../scripts/db-graph-with-schema --closed-maps --group-errors
|
||||
|
||||
e2e-test:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
@@ -25,10 +25,21 @@
|
||||
[date days]
|
||||
(new js/Date (- (.getTime date) (* days 24 60 60 1000))))
|
||||
|
||||
(defn- build-enum-config
|
||||
[]
|
||||
(let [values (->> ["joy" "sob" "upside_down_face"]
|
||||
(map #(vector (random-uuid) {:name %
|
||||
:description ""
|
||||
:icon {:id % :name % :type :emoji}}))
|
||||
(into {}))]
|
||||
{:values values
|
||||
:order (vec (keys values))}))
|
||||
|
||||
(defn- create-init-data
|
||||
[]
|
||||
(let [today (new js/Date)
|
||||
yesterday (subtract-days today 1)]
|
||||
yesterday (subtract-days today 1)
|
||||
enum-config (build-enum-config)]
|
||||
{:pages-and-blocks
|
||||
[{:page
|
||||
{:block/name (date-journal-title today) :block/journal? true :block/journal-day (date-journal-day today)}
|
||||
@@ -51,7 +62,8 @@
|
||||
{:block/content "page-many property block" :properties {:page-many #{[:page "page 1"] [:page "page 2"]}}}
|
||||
{:block/content "date property block" :properties {:date [:page (date-journal-title today)]}}
|
||||
{:block/content "date-many property block" :properties {:date-many #{[:page (date-journal-title today)]
|
||||
[:page (date-journal-title yesterday)]}}}]}
|
||||
[:page (date-journal-title yesterday)]}}}
|
||||
{:block/content "enum property block" :properties {:enum (-> enum-config :values keys first)}}]}
|
||||
{:page {:block/name "queries"}
|
||||
:blocks
|
||||
[{:block/content "{{query (property :default \"haha\")}}"}
|
||||
@@ -73,6 +85,8 @@
|
||||
(mapcat #(cond-> [[% {:block/schema {:type %}}]]
|
||||
(not (#{:checkbox :default} %))
|
||||
(conj [(keyword (str (name %) "-many")) {:block/schema {:type % :cardinality :many}}])))
|
||||
(into [[:enum {:block/schema {:type :enum
|
||||
:enum-config enum-config}}]])
|
||||
(into {}))}))
|
||||
|
||||
(defn -main [args]
|
||||
|
||||
Reference in New Issue
Block a user