From 4c30d4442b78252ba940cede96ddc9bed2ca40cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Smoczy=C5=84ski?= Date: Tue, 22 Sep 2020 16:22:17 +0200 Subject: [PATCH] [EGD-3797] change default country to unknown Can't assume that user is in Poland if number origin is unknown. Fix related unit tests. --- changelog.md | 1 + module-db/tests/CalllogRecord_tests.cpp | 2 +- module-services/service-desktop/tests/unittest.cpp | 4 ++-- module-utils/country.hpp | 2 +- module-utils/test/unittest_phonenumber.cpp | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/changelog.md b/changelog.md index 1aca3f556ce992a0ae7ac61fe1371eafa5cb46bc..3a089e017c6c84561f91aa493ef441f924ac502a 100644 --- a/changelog.md +++ b/changelog.md @@ -10,6 +10,7 @@ ### Changed * `[antenna-app]` Added parameter history window. +* `[phonenumber]` Change default country to unknown. ### Fixed diff --git a/module-db/tests/CalllogRecord_tests.cpp b/module-db/tests/CalllogRecord_tests.cpp index b05cd36098e84daec466ede9f55d08dc1028fc55..577baa38ee25ec9975f505f990f59ab5289c3f5e 100644 --- a/module-db/tests/CalllogRecord_tests.cpp +++ b/module-db/tests/CalllogRecord_tests.cpp @@ -72,7 +72,7 @@ TEST_CASE("Calllog Record tests") REQUIRE_FALSE(call.contactId == testRec.contactId); REQUIRE(call.contactId == 1); REQUIRE_FALSE(call.name == testRec.name); - REQUIRE(call.name == "600 123 456"); + REQUIRE(call.name == "600123456"); } SECTION("Entry update") diff --git a/module-services/service-desktop/tests/unittest.cpp b/module-services/service-desktop/tests/unittest.cpp index c00b876dcdf802e3935f0066459d8fda2aa0fa71..a7991dae85b509dadba9879014baad1648af42e4 100644 --- a/module-services/service-desktop/tests/unittest.cpp +++ b/module-services/service-desktop/tests/unittest.cpp @@ -141,7 +141,7 @@ TEST_CASE("DB Helpers test - json decoding") REQUIRE(contact.alternativeName == "Cic"); REQUIRE(contact.isOnBlocked() == true); REQUIRE(contact.isOnFavourites() == true); - REQUIRE(contact.numbers.at(0).number.getFormatted() == "724 842 187"); + REQUIRE(contact.numbers.at(0).number.getEntered() == "724842187"); REQUIRE(contact.primaryName == "Baatek"); } SECTION("incorrect json") @@ -151,7 +151,7 @@ TEST_CASE("DB Helpers test - json decoding") auto contactJson = json11::Json::parse(recordPayload, err); REQUIRE(err.empty()); - auto helper = std::make_unique(nullptr); + auto helper = std::make_unique(nullptr); auto contact = helper->from_json(contactJson); REQUIRE(contact.address == ""); REQUIRE(contact.alternativeName == "Cic"); diff --git a/module-utils/country.hpp b/module-utils/country.hpp index 835b9d18a9f8ca707035009674dade78549a5a67..e603f1f6bd2329a996571215014ccac7d30dd293 100644 --- a/module-utils/country.hpp +++ b/module-utils/country.hpp @@ -260,7 +260,7 @@ namespace utils::country }; constexpr std::size_t count = static_cast(Id::UNKNOWN) + 1; - constexpr Id defaultCountry = Id::POLAND; + constexpr Id defaultCountry = Id::UNKNOWN; struct Data { diff --git a/module-utils/test/unittest_phonenumber.cpp b/module-utils/test/unittest_phonenumber.cpp index 1e42ffa8bb80fc9d4954700c1eb3d8a7149ff8c7..18b5d660c61aa20c2e93fd768cc9621819026490 100644 --- a/module-utils/test/unittest_phonenumber.cpp +++ b/module-utils/test/unittest_phonenumber.cpp @@ -109,7 +109,7 @@ TEST_CASE("PhoneNumber - views") const std::string dummyNumber = "12345"; auto invalid_view = PhoneNumber::parse(dummyNumber); - auto valid_view = PhoneNumber::parse(pl_entered); + auto valid_view = PhoneNumber::parse(pl_e164); REQUIRE_FALSE(invalid_view.isValid()); REQUIRE(valid_view.isValid());