Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
z4kn4fein committed Jan 29, 2020
1 parent e9293cf commit 100475a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
8 changes: 1 addition & 7 deletions Tests/AutoPollingTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ class AutoPollingTests: XCTestCase {
let fetcher = ConfigFetcher(session: mockSession, apiKey: "", mode: mode)
let policy = mode.accept(visitor: RefreshPolicyFactory(fetcher: fetcher, cache: InMemoryConfigCache()))

sleep(1)

XCTAssertEqual("test", try policy.getConfiguration().get())

sleep(3)
Expand All @@ -30,8 +28,6 @@ class AutoPollingTests: XCTestCase {
let fetcher = ConfigFetcher(session: mockSession, apiKey: "", mode: mode)
let policy = mode.accept(visitor: RefreshPolicyFactory(fetcher: fetcher, cache: InMemoryConfigCache()))

sleep(1)

XCTAssertEqual("test", try policy.getConfiguration().get())

sleep(3)
Expand All @@ -47,9 +43,7 @@ class AutoPollingTests: XCTestCase {
let mode = PollingModes.autoPoll(autoPollIntervalInSeconds: 2)
let fetcher = ConfigFetcher(session: mockSession, apiKey: "", mode: mode)
let policy = mode.accept(visitor: RefreshPolicyFactory(fetcher: fetcher, cache: InMemoryConfigCache()))

sleep(1)


XCTAssertEqual("test", try policy.getConfiguration().get())

sleep(3)
Expand Down
2 changes: 1 addition & 1 deletion Tests/Mock.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class MockURLSession: URLSession {
completionHandler: @escaping CompletionHandler
) -> URLSessionDataTask {
self.requests.append(request)
let response = self.responses.removeFirst()
let response = self.responses.count == 1 ? self.responses[0] : self.responses.removeFirst()
let semaphore = DispatchSemaphore(value: 0)
return MockURLSessionDataTask {
self.queue.async {
Expand Down

0 comments on commit 100475a

Please sign in to comment.