Run lein ancient and updated dependencies.
to_psql_tests do NOT yet pass (new file, never has passed)
This commit is contained in:
parent
481fb5f535
commit
dd4120bb91
3 changed files with 76 additions and 3 deletions
73
test/adl/to_psql_test.clj
Normal file
73
test/adl/to_psql_test.clj
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
(ns adl.to-psql-test
|
||||
(:require [clojure.string :as s]
|
||||
[clojure.test :refer :all]
|
||||
[adl.to-psql :refer :all]
|
||||
[adl-support.utils :refer :all]))
|
||||
|
||||
(deftest create-table-test
|
||||
(testing "Generation of table creation"
|
||||
(let [application {:tag :application,
|
||||
:attrs {:version "0.1.1", :name "test-app"},
|
||||
:content
|
||||
[{:tag :entity,
|
||||
:attrs {:name "address"},
|
||||
:content
|
||||
[{:tag :key,
|
||||
:attrs nil,
|
||||
:content
|
||||
[{:tag :property,
|
||||
:attrs
|
||||
{:immutable "true",
|
||||
:required "true",
|
||||
:distinct "system",
|
||||
:type "integer",
|
||||
:name "id"},
|
||||
:content
|
||||
[{:tag :generator, :attrs {:action "native"}, :content nil}]}
|
||||
{:tag :property,
|
||||
:attrs
|
||||
{:immutable "true",
|
||||
:required "true",
|
||||
:distinct "all",
|
||||
:generator "assigned"
|
||||
:type "string",
|
||||
:size "12"
|
||||
:name "postcode"}}
|
||||
]}
|
||||
{:tag :property,
|
||||
:attrs
|
||||
{:distinct "user", :size "128", :type "string", :name "street"},
|
||||
:content nil}
|
||||
{:tag :property,
|
||||
:attrs {:size "64", :type "string", :name "town"},
|
||||
:content nil}
|
||||
{:tag :property,
|
||||
:attrs {:name "dwellings" :type "list" :entity "dwellings" :farkey "address_id"}}
|
||||
]}
|
||||
{:tag :entity,
|
||||
:attrs {:name "dwelling"},
|
||||
:content
|
||||
[{:tag :key,
|
||||
:attrs nil,
|
||||
:content
|
||||
[{:tag :property,
|
||||
:attrs
|
||||
{:immutable "true",
|
||||
:required "true",
|
||||
:distinct "system",
|
||||
:type "integer",
|
||||
:name "id"},
|
||||
:content
|
||||
[{:tag :generator, :attrs {:action "native"}, :content nil}]}]}
|
||||
{:tag :property
|
||||
:attrs
|
||||
{:name "address_id" :required "true" :type "entity" :entity "address" :farkey "id"}}
|
||||
{:tag :property
|
||||
:attrs
|
||||
{:name "sub_address" :type "string" :size "32"}}]}]}
|
||||
address-entity (child-with-tag application :entity #(= (:name %) "address"))
|
||||
dwelling-entity (child-with-tag application :entity #(= (:name %) "dwelling"))
|
||||
expected ""
|
||||
actual (emit-table address-entity application "Test doc")
|
||||
]
|
||||
(is (= actual expected)))))
|
||||
Loading…
Add table
Add a link
Reference in a new issue