diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index cef6dc411..c872b3b42 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -18,7 +18,9 @@ [discrete] === Fixed -* https://github.com/serpro69/kotlin-faker/issues/207[#207] (:core) Regexify generates invalid value +* https://github.com/serpro69/kotlin-faker/pull/240[#240] (:core) Fix NoSuchElementException in `uk.company.name` +** Also fixes `uk.name.first_name` and `uk.name.last_name` to return both male and female names. +* https://github.com/serpro69/kotlin-faker/issues/207[#207] (:core) Regexify generates invalid value * https://github.com/serpro69/kotlin-faker/issues/208[#208] (:core) Regexify fails with StackOverflowError [discrete] diff --git a/core/src/integration/kotlin/io/github/serpro69/kfaker/provider/AddressIT.kt b/core/src/integration/kotlin/io/github/serpro69/kfaker/provider/AddressIT.kt index 0239d826d..16312d8b1 100644 --- a/core/src/integration/kotlin/io/github/serpro69/kfaker/provider/AddressIT.kt +++ b/core/src/integration/kotlin/io/github/serpro69/kfaker/provider/AddressIT.kt @@ -21,6 +21,14 @@ class AddressIT : DescribeSpec({ address("uk").citySuffix() shouldBe "" } } + + context("non-default key reference - gh #239") { + repeat(10) { + it("city() does NOT throw NoSuchElementException run#$it") { + shouldNotThrow { address("uk").city() } + } + } + } } context("nb-NO locale") { diff --git a/core/src/integration/kotlin/io/github/serpro69/kfaker/provider/NameIT.kt b/core/src/integration/kotlin/io/github/serpro69/kfaker/provider/NameIT.kt index cffe83b47..32b74346a 100644 --- a/core/src/integration/kotlin/io/github/serpro69/kfaker/provider/NameIT.kt +++ b/core/src/integration/kotlin/io/github/serpro69/kfaker/provider/NameIT.kt @@ -9,6 +9,13 @@ class NameIT : DescribeSpec({ describe("Name provider") { val name: (locale: String) -> Name = { faker { fakerConfig { locale = it } }.name } + context("uk locale") { + it("generates a name") { + val names = List(42) { name("uk").name() } + names shouldNotContain "" + } + } + context("ru locale") { it("generates lastName") { val lastNames = List(42) { name("ru").lastName() } diff --git a/core/src/main/resources/locales/uk.yml b/core/src/main/resources/locales/uk.yml index fabfd2a19..d5973d60c 100644 --- a/core/src/main/resources/locales/uk.yml +++ b/core/src/main/resources/locales/uk.yml @@ -417,7 +417,7 @@ uk: - zt.ua - укр name: - male_first_name: &1 + male_first_name: &male_first_name # NB! do not change anchor name - Августин - Аврелій - Адам @@ -730,7 +730,7 @@ uk: - Юрійович - Юхимович - Ярославович - male_last_name: &2 + male_last_name: &male_last_name # NB! do not change anchor name - Андрухович - Бабух - Балабан @@ -970,7 +970,7 @@ uk: - Яцишин - Яцьків - Ящук - female_first_name: + female_first_name: &female_first_name # NB! do not change anchor name - Аврелія - Аврора - Агапія @@ -1281,7 +1281,7 @@ uk: - Юріївна - Юхимівна - Ярославівна - female_last_name: + female_last_name: &female_last_name # NB! do not change anchor name - Андрухович - Бабух - Балабан @@ -1512,8 +1512,12 @@ uk: - Яцишина - Яцьків - Ящук - first_name: *1 - last_name: *2 + first_name: # NB! do not change anchor references, we should include both female and male first names here + - *male_first_name + - *female_first_name + last_name: # NB! do not change anchor references, we should include both female and male last names here + - *male_last_name + - *female_last_name name: - "#{male_first_name} #{male_last_name}" - "#{male_last_name} #{male_first_name}" @@ -1781,11 +1785,10 @@ uk: - скло - дерево name: - - "#{prefix} #{Name.female_first_name}" - - "#{prefix} #{Name.male_first_name}" - - "#{prefix} #{Name.male_last_name}" - - "#{prefix} #{Address.city_name}#{product}#{suffix}" - - "#{prefix} #{Address.city_name}#{suffix}" + - "#{prefix} #{Name.first_name}" # NB! do not change, see #239 + - "#{prefix} #{Name.last_name}" # NB! do not change, see #239 + - "#{prefix} #{Address.city}#{product}#{suffix}" # NB! do not change, see #239 + - "#{prefix} #{Address.city}#{suffix}" # NB! do not change, see #239 music: instruments: - Електрична гітара diff --git a/faker/commerce/src/integration/kotlin/io/github/serpro69/kfaker/commerce/provider/CompanyIT.kt b/faker/commerce/src/integration/kotlin/io/github/serpro69/kfaker/commerce/provider/CompanyIT.kt index fc04d37d6..5a033a48d 100644 --- a/faker/commerce/src/integration/kotlin/io/github/serpro69/kfaker/commerce/provider/CompanyIT.kt +++ b/faker/commerce/src/integration/kotlin/io/github/serpro69/kfaker/commerce/provider/CompanyIT.kt @@ -9,6 +9,14 @@ class CompanyIT : DescribeSpec({ describe("Company Provider") { val company: (locale: String) -> Company = { faker { fakerConfig { locale = it } }.company } + context("uk locale") { + repeat(10) { + it("should generate a valid name run#$it") { + shouldNotThrow { company("uk").name() shouldNotBe "" } + } + } + } + context("ja locale") { it("should generate a valid name") { shouldNotThrow { company("ja").name() shouldNotBe "" }