Skip to content

Commit a354553

Browse files
chore: adding test for all types
Signed-off-by: Thomas Poignant <[email protected]>
1 parent f9fa6bb commit a354553

File tree

3 files changed

+369
-7
lines changed

3 files changed

+369
-7
lines changed

Sources/go-feature-flag-provider/go_feature_flag_provider.swift

-4
Original file line numberDiff line numberDiff line change
@@ -233,12 +233,9 @@ final class GoFeatureFlagProvider: FeatureProvider {
233233
self.apiRetryAfter = getRetryAfterDate(from: response.allHeaderFields)
234234
throw error
235235
default:
236-
// TODO: convert error in OpenFeatureError?
237236
throw error
238237
}
239238
} catch {
240-
print(error)
241-
// TODO: convert error in OpenFeatureError?
242239
throw error
243240
}
244241
}
@@ -283,7 +280,6 @@ final class GoFeatureFlagProvider: FeatureProvider {
283280
weakSelf.eventHandler.send(.error)
284281
}
285282
} catch {
286-
// TODO: manage error
287283
weakSelf.eventHandler.send(.error)
288284
}
289285
}

Tests/go-feature-flag-providerTests/ofrep_api_mock.swift

+66
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,72 @@ class MockNetworkingService: NetworkingService {
8787
"additionalProp2": true,
8888
"additionalProp3": true
8989
}
90+
},
91+
{
92+
"value": true,
93+
"key": "bool-flag",
94+
"reason": "TARGETING_MATCH",
95+
"variant": "variantA",
96+
"metadata": {
97+
"additionalProp1": true,
98+
"additionalProp2": true,
99+
"additionalProp3": true
100+
}
101+
},
102+
{
103+
"value": 1234,
104+
"key": "int-flag",
105+
"reason": "TARGETING_MATCH",
106+
"variant": "variantA",
107+
"metadata": {
108+
"additionalProp1": true,
109+
"additionalProp2": true,
110+
"additionalProp3": true
111+
}
112+
},
113+
{
114+
"value": 12.34,
115+
"key": "double-flag",
116+
"reason": "TARGETING_MATCH",
117+
"variant": "variantA",
118+
"metadata": {
119+
"additionalProp1": true,
120+
"additionalProp2": true,
121+
"additionalProp3": true
122+
}
123+
},
124+
{
125+
"value": "1234value",
126+
"key": "string-flag",
127+
"reason": "TARGETING_MATCH",
128+
"variant": "variantA",
129+
"metadata": {
130+
"additionalProp1": true,
131+
"additionalProp2": true,
132+
"additionalProp3": true
133+
}
134+
},
135+
{
136+
"value": {"testValue":{"toto":1234}},
137+
"key": "object-flag",
138+
"reason": "TARGETING_MATCH",
139+
"variant": "variantA",
140+
"metadata": {
141+
"additionalProp1": true,
142+
"additionalProp2": true,
143+
"additionalProp3": true
144+
}
145+
},
146+
{
147+
"value": [1234, 5678],
148+
"key": "array-flag",
149+
"reason": "TARGETING_MATCH",
150+
"variant": "variantA",
151+
"metadata": {
152+
"additionalProp1": true,
153+
"additionalProp2": true,
154+
"additionalProp3": true
155+
}
90156
}
91157
]
92158
}

0 commit comments

Comments
 (0)