-
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.
- Loading branch information
Showing
14 changed files
with
136 additions
and
10 deletions.
There are no files selected for viewing
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
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
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
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
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
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,17 @@ | ||
// | ||
// DeviceUtilityTests.swift | ||
// ConjugarTests | ||
// | ||
// Created by Joshua Adams on 4/24/19. | ||
// Copyright © 2019 Josh Adams. All rights reserved. | ||
// | ||
|
||
import XCTest | ||
@testable import Conjugar | ||
|
||
class DeviceUtilityTests: XCTestCase { | ||
func testModelName() { | ||
// This won't work if tests run on device. But in my case, they don't. | ||
XCTAssertEqual(UIDevice.current.modelName, "Simulator") | ||
} | ||
} |
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,27 @@ | ||
// | ||
// IntExtensionTests.swift | ||
// ConjugarTests | ||
// | ||
// Created by Joshua Adams on 4/24/19. | ||
// Copyright © 2019 Josh Adams. All rights reserved. | ||
// | ||
|
||
import XCTest | ||
@testable import Conjugar | ||
|
||
class IntExtensionTests: XCTestCase { | ||
func testShort() { | ||
let time = 42 | ||
XCTAssertEqual(time.timeString, "42") | ||
} | ||
|
||
func testMedium() { | ||
let time = 142 | ||
XCTAssertEqual(time.timeString, "2:22") | ||
} | ||
|
||
func testLong() { | ||
let time = 3601 | ||
XCTAssertEqual(time.timeString, "1:00:01") | ||
} | ||
} |
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,38 @@ | ||
// | ||
// TestGameCenterTests.swift | ||
// ConjugarTests | ||
// | ||
// Created by Joshua Adams on 4/24/19. | ||
// Copyright © 2019 Josh Adams. All rights reserved. | ||
// | ||
|
||
import XCTest | ||
@testable import Conjugar | ||
|
||
class TestGameCenterTests: XCTestCase { | ||
private let analytics = TestAnalyticsService() | ||
|
||
func testAuthenticate() { | ||
let tgc = TestGameCenter(isAuthenticated: false) | ||
|
||
tgc.authenticate(analyticsService: analytics, completion: { didAuthenticate in | ||
XCTAssert(didAuthenticate) | ||
|
||
tgc.authenticate(analyticsService: self.analytics, completion: { didAuthenticate in | ||
XCTAssertFalse(didAuthenticate) | ||
}) | ||
}) | ||
} | ||
|
||
func testReportScore() { | ||
// Nothing to test. Exercising for coverage. | ||
let tgc = TestGameCenter() | ||
tgc.reportScore(42) | ||
} | ||
|
||
func testShowLeaderboard() { | ||
// Nothing to test. Exercising for coverage. | ||
let tgc = TestGameCenter() | ||
tgc.showLeaderboard() | ||
} | ||
} |
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,21 @@ | ||
// | ||
// UIViewControllerExtensionTests.swift | ||
// ConjugarTests | ||
// | ||
// Created by Joshua Adams on 4/24/19. | ||
// Copyright © 2019 Josh Adams. All rights reserved. | ||
// | ||
|
||
import XCTest | ||
import UIKit | ||
@testable import Conjugar | ||
|
||
class UIViewControllerExtensionTests: XCTestCase { | ||
func testFatalCastMessage() { | ||
let vc = VerbVC() | ||
let view = VerbView() | ||
let message = vc.fatalCastMessage(view: view.self) | ||
XCTAssert(message.contains("Could not cast <Conjugar.VerbVC:")) | ||
XCTAssert(message.contains("to <Conjugar.VerbView:")) | ||
} | ||
} |