Closed timkimadobe closed 1 year ago
Merging #403 (7082bdc) into dev (c3ce8a6) will not change coverage. The diff coverage is
n/a
.
@@ Coverage Diff @@
## dev #403 +/- ##
=======================================
Coverage 96.77% 96.77%
=======================================
Files 27 27
Lines 1671 1671
=======================================
Hits 1617 1617
Misses 54 54
Planning on reimplementing using @Testable import AEPServices
instead
Description
This PR:
TestableNetworkRequest
wrapper aroundNetworkRequest
to enable custom conformance toEquatable
andHashable
for direct use as a dictionary key.NetworkServiceHelper
data structs to use use the newTestableNetworkRequest
as the dictionary key directly, and updates value types according to the new grouping behaviorsetResponseFor
method toaddResponseFor
to more accurately reflect what the method doesMock
andRealNetworkService
based on these changesMockNetworkService
: creates a new closure that creates a default mock response using a valid URLUpstreamIntegrationTests
to use optional chaining on the newly optional network response arrayMotivation: This update makes the custom implementation of
Equatable
andHashable
for testing purposes more explicit, and prevents accidental implementation errors, where the isCustomEquals is not applied correctly in the current implementation state. It also brings the iOS implementation in line with the Android version: https://github.com/adobe/aepsdk-edge-android/blob/main/code/edge/src/androidTest/java/com/adobe/marketing/mobile/services/TestableNetworkRequest.javaAlternative implementations considered: Using
extension NetworkRequest
and overriding the existingEquatable
andHashable
implementations is not possible based on the current minimum supported version of iOS 11.0, as iOS 13.0 is required to allow'@objc' property in extension of subclass
Question for reviewers:
i. Maybe using an underscored parameter for the networkRequest initializer?:
ii. Or using a custom
==
onTestableNetworkRequest
that can acceptNetworkRequest
as therhs
argument?NetworkRequest
'sEquatable
andHashable
implementations directly, but leaves a gap in functional and integration testing for iOS versions 11.0 <-> 12.X (highest up to 13.0)Related Issue
Motivation and Context
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: