Skip to content
Snippets Groups Projects
Commit 64eaa263 authored by Cam Saül's avatar Cam Saül
Browse files

Merge pull request #349 from metabase/additional_fk_sync_tests

add a couple of additional tests for FK syncing
parents 1211462b 89d3bfa8
Branches
Tags
No related merge requests found
......@@ -11,7 +11,7 @@
[metabase.test.util :refer [resolve-private-fns]]))
(resolve-private-fns metabase.driver.generic-sql.sync field-avg-length field-percent-urls set-table-pks-if-needed!)
(resolve-private-fns metabase.driver.generic-sql.sync determine-fk-type field-avg-length field-percent-urls set-table-pks-if-needed!)
(def users-table
(delay (sel :one Table :name "USERS")))
......@@ -107,6 +107,16 @@
(sync-table table)
(get-special-type-and-fk-exists?))]))
;; ## Tests for DETERMINE-FK-TYPE
;; Since COUNT(category_id) > COUNT(DISTINCT(category_id)) the FK relationship should be Mt1
(expect :Mt1
(determine-fk-type (korma-entity (sel :one Table :id (table->id :venues))) "CATEGORY_ID"))
;; Since COUNT(id) == COUNT(DISTINCT(id)) the FK relationship should be 1t1
;; (yes, ID isn't really a FK field, but determine-fk-type doesn't need to know that)
(expect :1t1
(determine-fk-type (korma-entity (sel :one Table :id (table->id :venues))) "ID"))
;; ## TEST FIELD-AVG-LENGTH
;; Test that this works if *sql-string-length-fn* is bound as exected
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment