-
Notifications
You must be signed in to change notification settings - Fork 39
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 #394 from mattpolzin/4_0-test-coverage
- Loading branch information
Showing
6 changed files
with
72 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// | ||
// ComponentKeyTests.swift | ||
// OpenAPIKit | ||
// | ||
// Created by Mathew Polzin on 2/16/25. | ||
// | ||
|
||
import OpenAPIKitCore | ||
import XCTest | ||
|
||
final class ComponentKeyTests: XCTestCase { | ||
func test_init() throws { | ||
let t1 : Shared.ComponentKey = "abcd" | ||
XCTAssertEqual(t1.rawValue, "abcd") | ||
|
||
let t2 = Shared.ComponentKey(rawValue: "abcd") | ||
XCTAssertEqual(t2?.rawValue, "abcd") | ||
|
||
let t3 = Shared.ComponentKey(rawValue: "") | ||
XCTAssertNil(t3) | ||
|
||
let t4 = Shared.ComponentKey(rawValue: "(abcd)") | ||
XCTAssertNil(t4) | ||
|
||
let t5 = try Shared.ComponentKey.forceInit(rawValue: "abcd") | ||
XCTAssertEqual(t5.rawValue, "abcd") | ||
|
||
XCTAssertThrowsError(try Shared.ComponentKey.forceInit(rawValue: nil)) | ||
XCTAssertThrowsError(try Shared.ComponentKey.forceInit(rawValue: "(abcd)")) | ||
} | ||
|
||
func test_problemString() { | ||
let message = Shared.ComponentKey.problem(with: "(abcd)") | ||
|
||
XCTAssertEqual(message, "Keys for components in the Components Object must conform to the regex `^[a-zA-Z0-9\\.\\-_]+$`. '(abcd)' does not..") | ||
|
||
let nonProblem = Shared.ComponentKey.problem(with: "abcd") | ||
XCTAssertNil(nonProblem) | ||
} | ||
} |
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