diff --git a/db-migration/db/seed/test_resolver/VernacularStringsSpec/vernacular_string_indices.csv b/db-migration/db/seed/test_resolver/VernacularStringsSpec/vernacular_string_indices.csv new file mode 100644 index 0000000..9587f7c --- /dev/null +++ b/db-migration/db/seed/test_resolver/VernacularStringsSpec/vernacular_string_indices.csv @@ -0,0 +1,18 @@ +1 11492995 127a5a98-26d0-5cce-b3f9-a518c0b3a9a4 German Germany DE +1 18158208 198976e7-627d-5489-a642-b91a44721b1e Eng NZL 047 +1 11492995 1dc94ad6-6f0f-555d-bd96-99241e7066c7 Russian Russia RU +1 18158208 219ef8ed-b275-5742-b1c6-9dc6a20869a0 Eng, mao NZL 047 +1 18158662 50c46865-1efd-5224-89de-6f6fd3dfba28 Eng USA US +1 11492995 65441ae1-e441-57eb-a010-8631e6d5324c Mongolian Mongolia MN +1 18158662 84edbfb0-4afd-5be8-8074-73bf7ec8bfbe Chi CHN 010 +1 11492995 8f757fed-35c4-5656-9c74-45f4626b874d Russian Russia RU +1 11492995 9b4b9655-1ac5-58c8-a481-0314ecbf88f4 Belorussian Belarus BY +1 11492995 9eedc318-5d85-5f11-97bc-3b1d6f69176b Russian Russia RU +1 18158208 a14bb642-e222-5d5c-90ca-501b9ed6f271 Mao NZL 047 +1 18158662 c8b480c2-e685-5bf4-ad19-c3aae29352b9 Ger DEU 006 +1 11492995 db23921d-d986-57a5-bee9-d112eb21e96e Russian Russia RU +1 18158662 e74d89c1-937b-514a-85e3-a206a3e97af0 Ita ITA 021 +1 11492995 eb1fbc70-a749-5f90-8445-b7775d542212 Armenian Armenia AM +1 11492995 eee419a1-7615-5200-ba78-cfe627fbac51 Russian Russia RU +1 18158662 fc45f46e-7915-533f-8e6b-97b7d2013b58 Eng GBR 011 +1 562767 fcdf2267-c214-548f-8b58-05633c5648d2 Russian Russia RU diff --git a/db-migration/db/seed/test_resolver/VernacularStringsSpec/vernacular_strings.csv b/db-migration/db/seed/test_resolver/VernacularStringsSpec/vernacular_strings.csv new file mode 100644 index 0000000..826e6b7 --- /dev/null +++ b/db-migration/db/seed/test_resolver/VernacularStringsSpec/vernacular_strings.csv @@ -0,0 +1,18 @@ +8f757fed-35c4-5656-9c74-45f4626b874d Goroshek Opushennyi +9eedc318-5d85-5f11-97bc-3b1d6f69176b Goroshek Sorno-Polevoi +e74d89c1-937b-514a-85e3-a206a3e97af0 Abete di Likiang +198976e7-627d-5489-a642-b91a44721b1e Celery pine +1dc94ad6-6f0f-555d-bd96-99241e7066c7 Goroshek Sornyi +84edbfb0-4afd-5be8-8074-73bf7ec8bfbe 丽江云杉 (li jiang yun shan) +fc45f46e-7915-533f-8e6b-97b7d2013b58 Likiang spruce +eee419a1-7615-5200-ba78-cfe627fbac51 Goroshek Uzkolistnyi +127a5a98-26d0-5cce-b3f9-a518c0b3a9a4 Schmalblattrige Wicke +9b4b9655-1ac5-58c8-a481-0314ecbf88f4 Garoshak Vuzkalisty +50c46865-1efd-5224-89de-6f6fd3dfba28 Lijiang spruce +a14bb642-e222-5d5c-90ca-501b9ed6f271 tanekaha +eb1fbc70-a749-5f90-8445-b7775d542212 Vik Nekhterev +219ef8ed-b275-5742-b1c6-9dc6a20869a0 Mountain toatoa +db23921d-d986-57a5-bee9-d112eb21e96e Uzunyarpag Lerke +65441ae1-e441-57eb-a010-8631e6d5324c Nariin Nabchit Gish +fcdf2267-c214-548f-8b58-05633c5648d2 blokha +c8b480c2-e685-5bf4-ad19-c3aae29352b9 Likiang-Fichte diff --git a/resolver/src/test/scala/org/globalnames/resolver/model/VernacularStringIndicesSpec.scala b/resolver/src/test/scala/org/globalnames/resolver/model/VernacularStringIndicesSpec.scala new file mode 100644 index 0000000..0230e47 --- /dev/null +++ b/resolver/src/test/scala/org/globalnames/resolver/model/VernacularStringIndicesSpec.scala @@ -0,0 +1,72 @@ +package org.globalnames +package resolver +package model + +import java.util.UUID + +import slick.driver.PostgresDriver.api._ + +class VernacularStringIndicesSpec extends SpecConfig { + val conn = Database.forConfig("postgresql-test") + seed("test_resolver", "VernacularStringsSpec") + + override def afterAll(): Unit = { + conn.close() + } + + describe("VernacularStringIndices") { + val vernacularStringIndices = TableQuery[VernacularStringIndices] + + it("contains several records") { + whenReady(conn.run(vernacularStringIndices.size.result)) { res => res should be > 1 } + } + + describe("#dataSourceId") { + it("returns a dataSourceId") { + whenReady(conn.run(vernacularStringIndices.map { _.dataSourceId }.result.head)) { res => + res shouldBe an[Integer] + } + } + } + + describe("#taxonId") { + it("returns a taxonId") { + whenReady(conn.run(vernacularStringIndices.map { _.taxonId }.result.head)) { res => + res shouldBe an[String] + } + } + } + + describe("#vernacularStringId") { + it("returns a vernacularStringId") { + whenReady(conn.run(vernacularStringIndices.map { _.vernacularStringId }.result.head)) { + res => res shouldBe an[UUID] + } + } + } + + describe("#language") { + it("returns a language") { + whenReady(conn.run(vernacularStringIndices.map { _.language }.result.head)) { res => + res.value shouldBe a[String] + } + } + } + + describe("#locality") { + it("returns a locality") { + whenReady(conn.run(vernacularStringIndices.map { _.locality }.result.head)) { res => + res.value shouldBe a[String] + } + } + } + + describe("#countryCode") { + it("returns a countryCode") { + whenReady(conn.run(vernacularStringIndices.map { _.countryCode }.result.head)) { res => + res.value shouldBe a[String] + } + } + } + } +} diff --git a/resolver/src/test/scala/org/globalnames/resolver/model/VernacularStringsSpec.scala b/resolver/src/test/scala/org/globalnames/resolver/model/VernacularStringsSpec.scala new file mode 100644 index 0000000..da4adfc --- /dev/null +++ b/resolver/src/test/scala/org/globalnames/resolver/model/VernacularStringsSpec.scala @@ -0,0 +1,40 @@ +package org.globalnames +package resolver +package model + +import java.util.UUID + +import slick.driver.PostgresDriver.api._ + +class VernacularStringsSpec extends SpecConfig { + val conn = Database.forConfig("postgresql-test") + seed("test_resolver", "VernacularStringsSpec") + + override def afterAll(): Unit = { + conn.close() + } + + describe("VernacularStrings") { + val vernacularStrings = TableQuery[VernacularStrings] + + it("contains several records") { + whenReady(conn.run(vernacularStrings.size.result)) { res => res should be > 1 } + } + + describe("#id") { + it("returns an id") { + whenReady(conn.run(vernacularStrings.map { _.id }.result.head)) { res => + res shouldBe an[UUID] + } + } + } + + describe("#name") { + it("returns a name") { + whenReady(conn.run(vernacularStrings.map { _.name }.result.head)) { res => + res shouldBe an[String] + } + } + } + } +}