Skip to content

Commit

Permalink
Removed force unwraps
Browse files Browse the repository at this point in the history
  • Loading branch information
NachoSoto committed Jun 21, 2023
1 parent ab72b7e commit 3b5b246
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions Tests/UnitTests/Networking/ETagManagerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ class ETagManagerTests: TestCase {
func testResponseIsStoredIfResponseCodeIs200AndVerificationSucceded() throws {
let request = URLRequest(url: Self.testURL)
let cacheKey = try request.cacheKey

let responseObject = try JSONSerialization.data(withJSONObject: ["a": "response"])
let response = self.eTagManager.httpResultFromCacheOrBackend(
with: self.responseForTest(
Expand Down Expand Up @@ -781,8 +781,7 @@ private extension ETagManagerTests {
statusCode: HTTPStatusCode = .success,
validationTime: Date? = nil,
verificationResult: RevenueCat.VerificationResult = .defaultValue) throws -> Data {
// swiftlint:disable:next force_try
let data = try! JSONSerialization.data(withJSONObject: ["arg": "value"])
let data = try JSONSerialization.data(withJSONObject: ["arg": "value"])

let etagAndResponse = ETagManager.Response(
eTag: Self.testETag,
Expand All @@ -791,7 +790,7 @@ private extension ETagManagerTests {
validationTime: validationTime,
verificationResult: verificationResult
)
self.mockUserDefaults.mockValues[try request.cacheKey] = etagAndResponse.asData()!
self.mockUserDefaults.mockValues[try request.cacheKey] = try XCTUnwrap(etagAndResponse.asData())

return data
}
Expand Down

0 comments on commit 3b5b246

Please sign in to comment.