From dbcf207efbdceae26339c3d436283ffa2d498a13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=B8rsten=20K=C3=B8hpeiss?= Date: Thu, 7 Sep 2023 18:17:09 +0200 Subject: [PATCH] feat: add danish country code (#2818) * feat: add danish country code * test: add tests for da_dk country_code * refactor: country_code should be an array to keep the pattern --- lib/locales/da-DK.yml | 2 ++ test/test_da_dk_locale.rb | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/lib/locales/da-DK.yml b/lib/locales/da-DK.yml index 217349b2cd..0f514a2617 100644 --- a/lib/locales/da-DK.yml +++ b/lib/locales/da-DK.yml @@ -52,6 +52,8 @@ da-DK: - "#{first_name} #{last_name} #{last_name}" - "#{first_name} #{last_name} #{last_name}" + country_code: ['45'] + phone_number: formats: - '## ## ## ##' diff --git a/test/test_da_dk_locale.rb b/test/test_da_dk_locale.rb index 2fe3d5bcbf..ef07cf3a8c 100644 --- a/test/test_da_dk_locale.rb +++ b/test/test_da_dk_locale.rb @@ -54,4 +54,10 @@ def test_da_dk_phone_number_methods assert_match(/(20)|(30)|(40)[\d\s]+$/, Faker::PhoneNumber.cell_phone) assert_match(/(\d\d[\s-]?){4}$/, Faker::PhoneNumber.phone_number) end + + def test_da_dk_counrty_code + assert_equal '+45', Faker::PhoneNumber.country_code + assert_match(/(\+45)[\s](\d\d[\s-]?){4}$/, Faker::PhoneNumber.phone_number_with_country_code) + assert_match(/(\+45)[\s](\d\d[\s-]?){4}$/, Faker::PhoneNumber.cell_phone_with_country_code) + end end