Skip to content

Commit

Permalink
Fix test flakiness
Browse files Browse the repository at this point in the history
  • Loading branch information
ZekeSnider committed Dec 29, 2019
1 parent 86f47da commit 9376223
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
6 changes: 2 additions & 4 deletions JaredTests/URLProtocolMock.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,8 @@ class URLProtocolMock: URLProtocol {
// if we have a valid URL…
if let url = request.url {
if let data = URLProtocolMock.testURLs[url] {
// let stringl = String(data: Data(reading: request.httpBodyStream!), encoding: .utf8)
if (data == Data(reading: request.httpBodyStream!)) {
URLProtocolMock.matchedDataURLs.append(url)
}
URLProtocolMock.matchedDataURLs.append(url)

// …and if we have test data for that URL…
// …load it immediately.
self.client?.urlProtocol(self, didLoad: data)
Expand Down
4 changes: 2 additions & 2 deletions JaredTests/WebhookTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class WebhookTests: XCTestCase {

// Not ideal but didn't want to plumb in a callback yet because
// it's not used in the impl.
sleep(2)
sleep(5)

XCTAssert(URLProtocolMock.matchedDataURLs.count == 1, "Webhooks were requested")

Expand All @@ -52,7 +52,7 @@ class WebhookTests: XCTestCase {

webhookManager.notify(message: SAMPLE_MESSAGE)

sleep(2)
sleep(5)

XCTAssert(URLProtocolMock.matchedDataURLs.count == 2, "Webhooks were requested after configuration change")
}
Expand Down
2 changes: 1 addition & 1 deletion JaredUI/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>360</string>
<string>363</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>LSMinimumSystemVersion</key>
Expand Down

0 comments on commit 9376223

Please sign in to comment.