-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from npr/feature/add-more-unit-tests
Add more unit tests
- Loading branch information
Showing
38 changed files
with
708 additions
and
356 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// | ||
// XCTestCase+Resource.swift | ||
// RADTests | ||
// | ||
// Copyright 2018 NPR | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use | ||
// this file except in compliance with the License. You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software distributed under the | ||
// License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, | ||
// either express or implied. See the License for the specific language governing permissions | ||
// and limitations under the License. | ||
// | ||
|
||
import XCTest | ||
import AVFoundation | ||
|
||
extension XCTestCase { | ||
func findResource( | ||
name: String, | ||
extension: String = "mp3", | ||
file: StaticString = #file, | ||
line: UInt = #line | ||
) -> AVPlayerItem! { | ||
guard let url = Bundle.testBundle.url( | ||
forResource: name, withExtension: `extension` | ||
) else { | ||
XCTFail("Resource is not available", file: file, line: line) | ||
return nil | ||
} | ||
return AVPlayerItem(url: url) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// | ||
// XCTestCase+Wait.swift | ||
// RADTests | ||
// | ||
// Copyright 2018 NPR | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use | ||
// this file except in compliance with the License. You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software distributed under the | ||
// License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, | ||
// either express or implied. See the License for the specific language governing permissions | ||
// and limitations under the License. | ||
// | ||
|
||
import XCTest | ||
|
||
extension XCTestCase { | ||
func wait(for timeout: TimeInterval) { | ||
let expectation = self.expectation(description: "Time did pass.") | ||
DispatchQueue.concurrent.asyncAfter( | ||
deadline: .now() + timeout, execute: { | ||
expectation.fulfill() | ||
}) | ||
wait(for: [expectation], timeout: timeout) | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file renamed
BIN
+1.65 MB
...ces/AudioFiles/240Events2TrackingUrls.mp3 → RADTests/Resources/AudioFiles/240Events.mp3
Binary file not shown.
Binary file not shown.
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"remoteAudioData":{"trackingUrls":["https:\/\/www.npr.org"],"events":[{"eventTime":"00:00:00.000"},{"eventTime":"00:00:00.500"},{"eventTime":"00:00:01.000"},{"eventTime":"00:00:01.500"},{"eventTime":"00:00:02.000"},{"eventTime":"00:00:02.500"},{"eventTime":"00:00:03.000"},{"eventTime":"00:00:03.500"},{"eventTime":"00:00:04.000"},{"eventTime":"00:00:04.500"},{"eventTime":"00:00:05.000"},{"eventTime":"00:00:05.500"},{"eventTime":"00:00:06.000"},{"eventTime":"00:00:06.500"},{"eventTime":"00:00:07.000"},{"eventTime":"00:00:07.500"},{"eventTime":"00:00:08.000"},{"eventTime":"00:00:08.500"},{"eventTime":"00:00:09.000"},{"eventTime":"00:00:09.500"},{"eventTime":"00:00:10.000"},{"eventTime":"00:00:10.500"},{"eventTime":"00:00:11.000"},{"eventTime":"00:00:11.500"},{"eventTime":"00:00:12.000"},{"eventTime":"00:00:12.500"},{"eventTime":"00:00:13.000"},{"eventTime":"00:00:13.500"},{"eventTime":"00:00:14.000"},{"eventTime":"00:00:14.500"},{"eventTime":"00:00:15.000"},{"eventTime":"00:00:15.500"},{"eventTime":"00:00:16.000"},{"eventTime":"00:00:16.500"},{"eventTime":"00:00:17.000"},{"eventTime":"00:00:17.500"},{"eventTime":"00:00:18.000"},{"eventTime":"00:00:18.500"},{"eventTime":"00:00:19.000"},{"eventTime":"00:00:19.500"},{"eventTime":"00:00:20.000"},{"eventTime":"00:00:20.500"},{"eventTime":"00:00:21.000"},{"eventTime":"00:00:21.500"},{"eventTime":"00:00:22.000"},{"eventTime":"00:00:22.500"},{"eventTime":"00:00:23.000"},{"eventTime":"00:00:23.500"},{"eventTime":"00:00:24.000"},{"eventTime":"00:00:24.500"},{"eventTime":"00:00:25.000"},{"eventTime":"00:00:25.500"},{"eventTime":"00:00:26.000"},{"eventTime":"00:00:26.500"},{"eventTime":"00:00:27.000"},{"eventTime":"00:00:27.500"},{"eventTime":"00:00:28.000"},{"eventTime":"00:00:28.500"},{"eventTime":"00:00:29.000"},{"eventTime":"00:00:29.500"},{"eventTime":"00:00:30.000"},{"eventTime":"00:00:30.500"},{"eventTime":"00:00:31.000"},{"eventTime":"00:00:31.500"},{"eventTime":"00:00:32.000"},{"eventTime":"00:00:32.500"},{"eventTime":"00:00:33.000"},{"eventTime":"00:00:33.500"},{"eventTime":"00:00:34.000"},{"eventTime":"00:00:34.500"},{"eventTime":"00:00:35.000"},{"eventTime":"00:00:35.500"},{"eventTime":"00:00:36.000"},{"eventTime":"00:00:36.500"},{"eventTime":"00:00:37.000"},{"eventTime":"00:00:37.500"},{"eventTime":"00:00:38.000"},{"eventTime":"00:00:38.500"},{"eventTime":"00:00:39.000"},{"eventTime":"00:00:39.500"},{"eventTime":"00:00:40.000"},{"eventTime":"00:00:40.500"},{"eventTime":"00:00:41.000"},{"eventTime":"00:00:41.500"},{"eventTime":"00:00:42.000"},{"eventTime":"00:00:42.500"},{"eventTime":"00:00:43.000"},{"eventTime":"00:00:43.500"},{"eventTime":"00:00:44.000"},{"eventTime":"00:00:44.500"},{"eventTime":"00:00:45.000"},{"eventTime":"00:00:45.500"},{"eventTime":"00:00:46.000"},{"eventTime":"00:00:46.500"},{"eventTime":"00:00:47.000"},{"eventTime":"00:00:47.500"},{"eventTime":"00:00:48.000"},{"eventTime":"00:00:48.500"},{"eventTime":"00:00:49.000"},{"eventTime":"00:00:49.500"},{"eventTime":"00:00:50.000"},{"eventTime":"00:00:50.500"},{"eventTime":"00:00:51.000"},{"eventTime":"00:00:51.500"},{"eventTime":"00:00:52.000"},{"eventTime":"00:00:52.500"},{"eventTime":"00:00:53.000"},{"eventTime":"00:00:53.500"},{"eventTime":"00:00:54.000"},{"eventTime":"00:00:54.500"},{"eventTime":"00:00:55.000"},{"eventTime":"00:00:55.500"},{"eventTime":"00:00:56.000"},{"eventTime":"00:00:56.500"},{"eventTime":"00:00:57.000"},{"eventTime":"00:00:57.500"},{"eventTime":"00:00:58.000"},{"eventTime":"00:00:58.500"},{"eventTime":"00:00:59.000"},{"eventTime":"00:00:59.500"},{"eventTime":"00:01:00.000"},{"eventTime":"00:01:00.500"},{"eventTime":"00:01:01.000"},{"eventTime":"00:01:01.500"},{"eventTime":"00:01:02.000"},{"eventTime":"00:01:02.500"},{"eventTime":"00:01:03.000"},{"eventTime":"00:01:03.500"},{"eventTime":"00:01:04.000"},{"eventTime":"00:01:04.500"},{"eventTime":"00:01:05.000"},{"eventTime":"00:01:05.500"},{"eventTime":"00:01:06.000"},{"eventTime":"00:01:06.500"},{"eventTime":"00:01:07.000"},{"eventTime":"00:01:07.500"},{"eventTime":"00:01:08.000"},{"eventTime":"00:01:08.500"},{"eventTime":"00:01:09.000"},{"eventTime":"00:01:09.500"},{"eventTime":"00:01:10.000"},{"eventTime":"00:01:10.500"},{"eventTime":"00:01:11.000"},{"eventTime":"00:01:11.500"},{"eventTime":"00:01:12.000"},{"eventTime":"00:01:12.500"},{"eventTime":"00:01:13.000"},{"eventTime":"00:01:13.500"},{"eventTime":"00:01:14.000"},{"eventTime":"00:01:14.500"},{"eventTime":"00:01:15.000"},{"eventTime":"00:01:15.500"},{"eventTime":"00:01:16.000"},{"eventTime":"00:01:16.500"},{"eventTime":"00:01:17.000"},{"eventTime":"00:01:17.500"},{"eventTime":"00:01:18.000"},{"eventTime":"00:01:18.500"},{"eventTime":"00:01:19.000"},{"eventTime":"00:01:19.500"},{"eventTime":"00:01:20.000"},{"eventTime":"00:01:20.500"},{"eventTime":"00:01:21.000"},{"eventTime":"00:01:21.500"},{"eventTime":"00:01:22.000"},{"eventTime":"00:01:22.500"},{"eventTime":"00:01:23.000"},{"eventTime":"00:01:23.500"},{"eventTime":"00:01:24.000"},{"eventTime":"00:01:24.500"},{"eventTime":"00:01:25.000"},{"eventTime":"00:01:25.500"},{"eventTime":"00:01:26.000"},{"eventTime":"00:01:26.500"},{"eventTime":"00:01:27.000"},{"eventTime":"00:01:27.500"},{"eventTime":"00:01:28.000"},{"eventTime":"00:01:28.500"},{"eventTime":"00:01:29.000"},{"eventTime":"00:01:29.500"},{"eventTime":"00:01:30.000"},{"eventTime":"00:01:30.500"},{"eventTime":"00:01:31.000"},{"eventTime":"00:01:31.500"},{"eventTime":"00:01:32.000"},{"eventTime":"00:01:32.500"},{"eventTime":"00:01:33.000"},{"eventTime":"00:01:33.500"},{"eventTime":"00:01:34.000"},{"eventTime":"00:01:34.500"},{"eventTime":"00:01:35.000"},{"eventTime":"00:01:35.500"},{"eventTime":"00:01:36.000"},{"eventTime":"00:01:36.500"},{"eventTime":"00:01:37.000"},{"eventTime":"00:01:37.500"},{"eventTime":"00:01:38.000"},{"eventTime":"00:01:38.500"},{"eventTime":"00:01:39.000"},{"eventTime":"00:01:39.500"},{"eventTime":"00:01:40.000"},{"eventTime":"00:01:40.500"},{"eventTime":"00:01:41.000"},{"eventTime":"00:01:41.500"},{"eventTime":"00:01:42.000"},{"eventTime":"00:01:42.500"},{"eventTime":"00:01:43.000"},{"eventTime":"00:01:43.500"},{"eventTime":"00:01:44.000"},{"eventTime":"00:01:44.500"},{"eventTime":"00:01:45.000"},{"eventTime":"00:01:45.500"},{"eventTime":"00:01:46.000"},{"eventTime":"00:01:46.500"},{"eventTime":"00:01:47.000"},{"eventTime":"00:01:47.500"},{"eventTime":"00:01:48.000"},{"eventTime":"00:01:48.500"},{"eventTime":"00:01:49.000"},{"eventTime":"00:01:49.500"},{"eventTime":"00:01:50.000"},{"eventTime":"00:01:50.500"},{"eventTime":"00:01:51.000"},{"eventTime":"00:01:51.500"},{"eventTime":"00:01:52.000"},{"eventTime":"00:01:52.500"},{"eventTime":"00:01:53.000"},{"eventTime":"00:01:53.500"},{"eventTime":"00:01:54.000"},{"eventTime":"00:01:54.500"},{"eventTime":"00:01:55.000"},{"eventTime":"00:01:55.500"},{"eventTime":"00:01:56.000"},{"eventTime":"00:01:56.500"},{"eventTime":"00:01:57.000"},{"eventTime":"00:01:57.500"},{"eventTime":"00:01:58.000"},{"eventTime":"00:01:58.500"},{"eventTime":"00:01:59.000"},{"eventTime":"00:01:59.500"},{"eventTime":"00:01:60.000"}]}} |
Oops, something went wrong.