fidel-react-native 2.2.1 → 2.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/android/.gradle/8.10/checksums/checksums.lock +0 -0
- package/android/.gradle/8.10/dependencies-accessors/gc.properties +0 -0
- package/android/.gradle/8.10/executionHistory/executionHistory.bin +0 -0
- package/android/.gradle/8.10/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/8.10/fileChanges/last-build.bin +0 -0
- package/android/.gradle/8.10/fileHashes/fileHashes.bin +0 -0
- package/android/.gradle/8.10/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/8.10/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
- package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
- package/android/.gradle/config.properties +2 -0
- package/android/.gradle/file-system.probe +0 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/.idea/AndroidProjectSystem.xml +6 -0
- package/android/.idea/caches/deviceStreaming.xml +835 -0
- package/android/.idea/gradle.xml +12 -0
- package/android/.idea/migrations.xml +10 -0
- package/android/.idea/misc.xml +10 -0
- package/android/.idea/runConfigurations.xml +17 -0
- package/android/.idea/vcs.xml +6 -0
- package/android/build.gradle +1 -1
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +7 -0
- package/android/gradlew +252 -0
- package/android/gradlew.bat +94 -0
- package/android/local.properties +8 -0
- package/android/src/main/java/com/fidelreactlibrary/adapters/FidelCountryAdapter.java +55 -1
- package/android/src/test/java/com/fidelreactlibrary/adapters/FidelCountryAdapterTests.java +150 -18
- package/ios/Constants/CountryConstants.swift +59 -22
- package/package.json +1 -1
|
@@ -19,14 +19,11 @@ import static org.junit.Assert.*;
|
|
|
19
19
|
public class FidelCountryAdapterTests {
|
|
20
20
|
|
|
21
21
|
private static final String COUNTRIES_KEY = "Country";
|
|
22
|
-
|
|
23
22
|
private FidelCountryAdapter sut;
|
|
24
|
-
|
|
25
23
|
@Before
|
|
26
24
|
public final void setUp() {
|
|
27
25
|
sut = new FidelCountryAdapter();
|
|
28
26
|
}
|
|
29
|
-
|
|
30
27
|
@After
|
|
31
28
|
public final void tearDown() {
|
|
32
29
|
sut = null;
|
|
@@ -71,11 +68,6 @@ public class FidelCountryAdapterTests {
|
|
|
71
68
|
assertEquals("sweden", sut.jsCountryValue(Country.SWEDEN));
|
|
72
69
|
}
|
|
73
70
|
|
|
74
|
-
@Test
|
|
75
|
-
public void test_WhenAskedForNorwayCountryValue_ItProvidesTheCorrectOne() {
|
|
76
|
-
assertEquals("norway", sut.jsCountryValue(Country.NORWAY));
|
|
77
|
-
}
|
|
78
|
-
|
|
79
71
|
@Test
|
|
80
72
|
public void test_WhenAskedForUnitedArabEmiratesCountryValue_ItProvidesTheCorrectOne() {
|
|
81
73
|
assertEquals("unitedArabEmirates", sut.jsCountryValue(Country.UNITED_ARAB_EMIRATES));
|
|
@@ -91,6 +83,101 @@ public class FidelCountryAdapterTests {
|
|
|
91
83
|
assertEquals("unitedStates", sut.jsCountryValue(Country.UNITED_STATES));
|
|
92
84
|
}
|
|
93
85
|
|
|
86
|
+
@Test
|
|
87
|
+
public void test_WhenAskedForNorwayCountryValue_ItProvidesTheCorrectOne() {
|
|
88
|
+
assertEquals("norway", sut.jsCountryValue(Country.NORWAY));
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
@Test
|
|
92
|
+
public void test_WhenAskedForAustraliaCountryValue_ItProvidesTheCorrectOne() {
|
|
93
|
+
assertEquals("australia", sut.jsCountryValue(Country.AUSTRALIA));
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
@Test
|
|
97
|
+
public void test_WhenAskedForNewZealandCountryValue_ItProvidesTheCorrectOne() {
|
|
98
|
+
assertEquals("newZealand", sut.jsCountryValue(Country.NEW_ZEALAND));
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
@Test
|
|
102
|
+
public void test_WhenAskedForHongKongCountryValue_ItProvidesTheCorrectOne() {
|
|
103
|
+
assertEquals("hongKong", sut.jsCountryValue(Country.HONG_KONG));
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
@Test
|
|
107
|
+
public void test_WhenAskedForPhilippinesCountryValue_ItProvidesTheCorrectOne() {
|
|
108
|
+
assertEquals("philippines", sut.jsCountryValue(Country.PHILIPPINES));
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
@Test
|
|
112
|
+
public void test_WhenAskedForSingaporeCountryValue_ItProvidesTheCorrectOne() {
|
|
113
|
+
assertEquals("singapore", sut.jsCountryValue(Country.SINGAPORE));
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
@Test
|
|
117
|
+
public void test_WhenAskedForVietnamCountryValue_ItProvidesTheCorrectOne() {
|
|
118
|
+
assertEquals("vietnam", sut.jsCountryValue(Country.VIETNAM));
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
@Test
|
|
122
|
+
public void test_WhenAskedForSwitzerlandCountryValue_ItProvidesTheCorrectOne() {
|
|
123
|
+
assertEquals("switzerland", sut.jsCountryValue(Country.SWITZERLAND));
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
@Test
|
|
127
|
+
public void test_WhenAskedForFinlandCountryValue_ItProvidesTheCorrectOne() {
|
|
128
|
+
assertEquals("finland", sut.jsCountryValue(Country.FINLAND));
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
@Test
|
|
132
|
+
public void test_WhenAskedForDenmarkCountryValue_ItProvidesTheCorrectOne() {
|
|
133
|
+
assertEquals("denmark", sut.jsCountryValue(Country.DENMARK));
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
@Test
|
|
137
|
+
public void test_WhenAskedForBrazilCountryValue_ItProvidesTheCorrectOne() {
|
|
138
|
+
assertEquals("brazil", sut.jsCountryValue(Country.BRAZIL));
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
@Test
|
|
142
|
+
public void test_WhenAskedForEgyptCountryValue_ItProvidesTheCorrectOne() {
|
|
143
|
+
assertEquals("egypt", sut.jsCountryValue(Country.EGYPT));
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
@Test
|
|
147
|
+
public void test_WhenAskedForOmanCountryValue_ItProvidesTheCorrectOne() {
|
|
148
|
+
assertEquals("oman", sut.jsCountryValue(Country.OMAN));
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
@Test
|
|
152
|
+
public void test_WhenAskedForQatarCountryValue_ItProvidesTheCorrectOne() {
|
|
153
|
+
assertEquals("qatar", sut.jsCountryValue(Country.QATAR));
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
@Test
|
|
157
|
+
public void test_WhenAskedForBahrainCountryValue_ItProvidesTheCorrectOne() {
|
|
158
|
+
assertEquals("bahrain", sut.jsCountryValue(Country.BAHRAIN));
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
@Test
|
|
162
|
+
public void test_WhenAskedForKuwaitCountryValue_ItProvidesTheCorrectOne() {
|
|
163
|
+
assertEquals("kuwait", sut.jsCountryValue(Country.KUWAIT));
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
@Test
|
|
167
|
+
public void test_WhenAskedForSaudiArabiaCountryValue_ItProvidesTheCorrectOne() {
|
|
168
|
+
assertEquals("saudiArabia", sut.jsCountryValue(Country.SAUDI_ARABIA));
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
@Test
|
|
172
|
+
public void test_WhenAskedForJordanCountryValue_ItProvidesTheCorrectOne() {
|
|
173
|
+
assertEquals("jordan", sut.jsCountryValue(Country.JORDAN));
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
@Test
|
|
177
|
+
public void test_WhenAskedForSouthAfricaCountryValue_ItProvidesTheCorrectOne() {
|
|
178
|
+
assertEquals("southAfrica", sut.jsCountryValue(Country.SOUTH_AFRICA));
|
|
179
|
+
}
|
|
180
|
+
|
|
94
181
|
@Test
|
|
95
182
|
public void test_WhenCountryOrdinalNumberIsTooHigh_ReturnEmptyCountriesSet() {
|
|
96
183
|
String[] countriesArrayValues = new String[]{"something unrecognizable"};
|
|
@@ -111,18 +198,63 @@ public class FidelCountryAdapterTests {
|
|
|
111
198
|
@Test
|
|
112
199
|
public void test_WhenCountryJSValuesAreValid_ReturnCorrectCountriesSet() {
|
|
113
200
|
ReadableArray countriesArrayValues = JavaOnlyArray.of(
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
201
|
+
sut.jsCountryValue(Country.CANADA),
|
|
202
|
+
sut.jsCountryValue(Country.UNITED_ARAB_EMIRATES),
|
|
203
|
+
sut.jsCountryValue(Country.UNITED_KINGDOM),
|
|
204
|
+
sut.jsCountryValue(Country.SWEDEN),
|
|
205
|
+
sut.jsCountryValue(Country.UNITED_STATES),
|
|
206
|
+
sut.jsCountryValue(Country.IRELAND),
|
|
207
|
+
sut.jsCountryValue(Country.JAPAN),
|
|
208
|
+
sut.jsCountryValue(Country.NORWAY),
|
|
209
|
+
sut.jsCountryValue(Country.AUSTRALIA),
|
|
210
|
+
sut.jsCountryValue(Country.NEW_ZEALAND),
|
|
211
|
+
sut.jsCountryValue(Country.HONG_KONG),
|
|
212
|
+
sut.jsCountryValue(Country.PHILIPPINES),
|
|
213
|
+
sut.jsCountryValue(Country.SINGAPORE),
|
|
214
|
+
sut.jsCountryValue(Country.VIETNAM),
|
|
215
|
+
sut.jsCountryValue(Country.SWITZERLAND),
|
|
216
|
+
sut.jsCountryValue(Country.FINLAND),
|
|
217
|
+
sut.jsCountryValue(Country.DENMARK),
|
|
218
|
+
sut.jsCountryValue(Country.BRAZIL),
|
|
219
|
+
sut.jsCountryValue(Country.EGYPT),
|
|
220
|
+
sut.jsCountryValue(Country.OMAN),
|
|
221
|
+
sut.jsCountryValue(Country.QATAR),
|
|
222
|
+
sut.jsCountryValue(Country.BAHRAIN),
|
|
223
|
+
sut.jsCountryValue(Country.KUWAIT),
|
|
224
|
+
sut.jsCountryValue(Country.SAUDI_ARABIA),
|
|
225
|
+
sut.jsCountryValue(Country.JORDAN),
|
|
226
|
+
sut.jsCountryValue(Country.SOUTH_AFRICA)
|
|
227
|
+
);
|
|
228
|
+
|
|
229
|
+
Set<Country> expectedCountries = EnumSet.of(
|
|
230
|
+
Country.CANADA,
|
|
231
|
+
Country.UNITED_ARAB_EMIRATES,
|
|
232
|
+
Country.UNITED_KINGDOM,
|
|
233
|
+
Country.SWEDEN,
|
|
234
|
+
Country.UNITED_STATES,
|
|
235
|
+
Country.IRELAND,
|
|
236
|
+
Country.JAPAN,
|
|
237
|
+
Country.NORWAY,
|
|
238
|
+
Country.AUSTRALIA,
|
|
239
|
+
Country.NEW_ZEALAND,
|
|
240
|
+
Country.HONG_KONG,
|
|
241
|
+
Country.PHILIPPINES,
|
|
242
|
+
Country.SINGAPORE,
|
|
243
|
+
Country.VIETNAM,
|
|
244
|
+
Country.SWITZERLAND,
|
|
245
|
+
Country.FINLAND,
|
|
246
|
+
Country.DENMARK,
|
|
247
|
+
Country.BRAZIL,
|
|
248
|
+
Country.EGYPT,
|
|
249
|
+
Country.OMAN,
|
|
250
|
+
Country.QATAR,
|
|
251
|
+
Country.BAHRAIN,
|
|
252
|
+
Country.KUWAIT,
|
|
253
|
+
Country.SAUDI_ARABIA,
|
|
254
|
+
Country.JORDAN,
|
|
255
|
+
Country.SOUTH_AFRICA
|
|
122
256
|
);
|
|
123
257
|
|
|
124
|
-
Set<Country> expectedCountries = EnumSet.of(Country.CANADA, Country.UNITED_ARAB_EMIRATES, Country.UNITED_KINGDOM,
|
|
125
|
-
Country.SWEDEN, Country.UNITED_STATES, Country.IRELAND, Country.JAPAN, Country.NORWAY);
|
|
126
258
|
Set<Country> adaptedCountries = sut.parseAllowedCountries(countriesArrayValues);
|
|
127
259
|
|
|
128
260
|
assertEquals(countriesArrayValues.size(), adaptedCountries.size());
|
|
@@ -9,39 +9,76 @@ import Foundation
|
|
|
9
9
|
import Fidel
|
|
10
10
|
|
|
11
11
|
extension Country: ConstantsProvider {
|
|
12
|
-
|
|
12
|
+
|
|
13
13
|
var constantKey: String {
|
|
14
14
|
switch self {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
15
|
+
case .canada: return "canada"
|
|
16
|
+
case .ireland: return "ireland"
|
|
17
|
+
case .japan: return "japan"
|
|
18
|
+
case .sweden: return "sweden"
|
|
19
|
+
case .unitedArabEmirates: return "unitedArabEmirates"
|
|
20
|
+
case .unitedKingdom: return "unitedKingdom"
|
|
21
|
+
case .unitedStates: return "unitedStates"
|
|
22
|
+
case .norway: return "norway"
|
|
23
|
+
case .australia: return "australia"
|
|
24
|
+
case .newZealand: return "newZealand"
|
|
25
|
+
case .hongKong: return "hongKong"
|
|
26
|
+
case .philippines: return "philippines"
|
|
27
|
+
case .singapore: return "singapore"
|
|
28
|
+
case .vietnam: return "vietnam"
|
|
29
|
+
case .switzerland: return "switzerland"
|
|
30
|
+
case .finland: return "finland"
|
|
31
|
+
case .denmark: return "denmark"
|
|
32
|
+
case .brazil: return "brazil"
|
|
33
|
+
case .egypt: return "egypt"
|
|
34
|
+
case .oman: return "oman"
|
|
35
|
+
case .qatar: return "qatar"
|
|
36
|
+
case .bahrain: return "bahrain"
|
|
37
|
+
case .kuwait: return "kuwait"
|
|
38
|
+
case .saudiArabia: return "saudiArabia"
|
|
39
|
+
case .jordan: return "jordan"
|
|
40
|
+
case .southAfrica: return "southAfrica"
|
|
41
|
+
@unknown default: return "unexpected"
|
|
24
42
|
}
|
|
25
43
|
}
|
|
26
|
-
|
|
44
|
+
|
|
45
|
+
|
|
27
46
|
static var allCases: Set<Country> = Country.allCountries
|
|
28
47
|
static var parentKeyName: String = String(describing: Self.self)
|
|
29
|
-
|
|
48
|
+
|
|
30
49
|
static func countriesSet(from countryConstantKeys: [String]) -> Set<Country> {
|
|
31
50
|
return Set<Country>(countryConstantKeys.compactMap { Country.country(from: $0) })
|
|
32
51
|
}
|
|
33
|
-
|
|
52
|
+
|
|
34
53
|
static func country(from countryConstantKey: String) -> Country? {
|
|
35
54
|
switch countryConstantKey {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
55
|
+
case "canada": return .canada
|
|
56
|
+
case "ireland": return .ireland
|
|
57
|
+
case "japan": return .japan
|
|
58
|
+
case "sweden": return .sweden
|
|
59
|
+
case "unitedArabEmirates": return .unitedArabEmirates
|
|
60
|
+
case "unitedKingdom": return .unitedKingdom
|
|
61
|
+
case "unitedStates": return .unitedStates
|
|
62
|
+
case "norway": return .norway
|
|
63
|
+
case "australia": return .australia
|
|
64
|
+
case "newZealand": return .newZealand
|
|
65
|
+
case "hongKong": return .hongKong
|
|
66
|
+
case "philippines": return .philippines
|
|
67
|
+
case "singapore": return .singapore
|
|
68
|
+
case "vietnam": return .vietnam
|
|
69
|
+
case "switzerland": return .switzerland
|
|
70
|
+
case "finland": return .finland
|
|
71
|
+
case "denmark": return .denmark
|
|
72
|
+
case "brazil": return .brazil
|
|
73
|
+
case "egypt": return .egypt
|
|
74
|
+
case "oman": return .oman
|
|
75
|
+
case "qatar": return .qatar
|
|
76
|
+
case "bahrain": return .bahrain
|
|
77
|
+
case "kuwait": return .kuwait
|
|
78
|
+
case "saudiArabia": return .saudiArabia
|
|
79
|
+
case "jordan": return .jordan
|
|
80
|
+
case "southAfrica": return .southAfrica
|
|
81
|
+
default: return nil
|
|
45
82
|
}
|
|
46
83
|
}
|
|
47
84
|
}
|