Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
mdboom committed Mar 31, 2020
1 parent 90baee5 commit 1b6bfe5
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions glean-core/ios/GleanTests/GleanTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -152,17 +152,17 @@ class GleanTests: XCTestCase {
XCTAssertNil(error, "Test timed out waiting for upload: \(error!)")
}
}

func testSendingDeletionPingIfDisabledOutsideOfRun() {
// Set up the test stub based on the default telemetry endpoint
let host = URL(string: Configuration.Constants.defaultTelemetryEndpoint)!.host!
stub(condition: isHost(host)) { data in
let path = (data as NSURLRequest).url!

let parts = path.absoluteString.split(separator: "/")

XCTAssertEqual("deletion-request", parts[4])

DispatchQueue.main.async {
// let the response get processed before we mark the expectation fulfilled
self.expectation?.fulfill()
Expand All @@ -180,21 +180,21 @@ class GleanTests: XCTestCase {

// Reset Glean with uploadEnabled
Glean.shared.resetGlean(clearStores: true, uploadEnabled: true)

// Now reset Glean with uploadEnabled = false and not clearing the stores to
// trigger the deletion request ping.
Glean.shared.resetGlean(clearStores: false, uploadEnabled: false)
waitForExpectations(timeout: 5.0) { error in
XCTAssertNil(error, "Test timed out waiting for upload: \(error!)")
}
}

func testNotSendingDeletionRequestIfUnchangedOutsideOfRun() {
// Set up the test stub based on the default telemetry endpoint
let host = URL(string: Configuration.Constants.defaultTelemetryEndpoint)!.host!
stub(condition: isHost(host)) { _ in
XCTFail("Should not have recieved any ping")

DispatchQueue.main.async {
// let the response get processed before we mark the expectation fulfilled
self.expectation?.fulfill()
Expand All @@ -210,15 +210,15 @@ class GleanTests: XCTestCase {
// Set up the expectation that will NOT be fulfilled by the stub above. If it is
// then it will trigger an assertion due to the `assertForOverFulfill` property.
expectation = expectation(description: "Deletion Request Received")

// So we can wait for expectations below, we will go ahead and fulfill the
// expectation. We want to assert if the ping is triggered and over fulfills it
// from the stub above.
expectation?.fulfill()

// Reset Glean with uploadEnabled = false
Glean.shared.resetGlean(clearStores: true, uploadEnabled: false)

// Now reset Glean with uploadEnabled = false again without clearing the stores to
// make sure we don't trigger the deletion request ping. If it does, then we will
// have overfulfilled the expectation which will trigger a test assertion.
Expand Down

0 comments on commit 1b6bfe5

Please sign in to comment.