1
1
//
2
- // TemplatedURLTests .swift
2
+ // URLTemplateTests .swift
3
3
//
4
4
//
5
5
// Created by Mathew Polzin on 8/13/20.
@@ -9,24 +9,24 @@ import Foundation
9
9
import OpenAPIKit
10
10
import XCTest
11
11
12
- final class TemplatedURLTests : XCTestCase {
12
+ final class URLTemplateTests : XCTestCase {
13
13
func test_init( ) {
14
- XCTAssertNotNil ( TemplatedURL ( rawValue: " https://website.com " ) )
15
- XCTAssertEqual ( TemplatedURL ( rawValue: " https://website.com " ) , TemplatedURL ( url: URL ( string: " https://website.com " ) !) )
14
+ XCTAssertNotNil ( URLTemplate ( rawValue: " https://website.com " ) )
15
+ XCTAssertEqual ( URLTemplate ( rawValue: " https://website.com " ) , URLTemplate ( url: URL ( string: " https://website.com " ) !) )
16
16
}
17
17
18
18
func test_urlAccess( ) {
19
- let t1 = TemplatedURL ( rawValue: " https://website.com " )
20
- let t2 = TemplatedURL ( rawValue: " {scheme}://website.com " )
19
+ let t1 = URLTemplate ( rawValue: " https://website.com " )
20
+ let t2 = URLTemplate ( rawValue: " {scheme}://website.com " )
21
21
22
22
XCTAssertEqual ( t1? . url, URL ( string: " https://website.com " ) )
23
23
XCTAssertNil ( t2? . url)
24
24
}
25
25
26
26
func test_absoluteString( ) {
27
- let t1 = TemplatedURL ( rawValue: " https://website.com " )
28
- let t2 = TemplatedURL ( rawValue: " /a/relative/path " )
29
- let t3 = TemplatedURL ( rawValue: " website.com?query=value " )
27
+ let t1 = URLTemplate ( rawValue: " https://website.com " )
28
+ let t2 = URLTemplate ( rawValue: " /a/relative/path " )
29
+ let t3 = URLTemplate ( rawValue: " website.com?query=value " )
30
30
31
31
XCTAssertEqual ( t1? . absoluteString, URL ( string: " https://website.com " ) ? . absoluteString)
32
32
XCTAssertEqual ( t2? . absoluteString, URL ( string: " /a/relative/path " ) ? . absoluteString)
@@ -35,10 +35,10 @@ final class TemplatedURLTests: XCTestCase {
35
35
}
36
36
37
37
// MARK: - Codable
38
- extension TemplatedURLTests {
38
+ extension URLTemplateTests {
39
39
func test_encode( ) throws {
40
40
let t1 = TemplatedURLWrapper (
41
- url: TemplatedURL ( rawValue: " https://website.com " )
41
+ url: URLTemplate ( rawValue: " https://website.com " )
42
42
)
43
43
44
44
assertJSONEquivalent (
@@ -62,13 +62,13 @@ extension TemplatedURLTests {
62
62
63
63
XCTAssertEqual (
64
64
t1. url,
65
- TemplatedURL ( rawValue: " https://website.com " )
65
+ URLTemplate ( rawValue: " https://website.com " )
66
66
)
67
67
}
68
68
69
69
func test_encode_withVariables( ) throws {
70
70
let t1 = TemplatedURLWrapper (
71
- url: TemplatedURL ( rawValue: " {scheme}://{host}.com " )
71
+ url: URLTemplate ( rawValue: " {scheme}://{host}.com " )
72
72
)
73
73
74
74
assertJSONEquivalent (
@@ -92,11 +92,11 @@ extension TemplatedURLTests {
92
92
93
93
XCTAssertEqual (
94
94
t1. url,
95
- TemplatedURL ( rawValue: " {scheme}://{host}.com " )
95
+ URLTemplate ( rawValue: " {scheme}://{host}.com " )
96
96
)
97
97
}
98
98
}
99
99
100
100
fileprivate struct TemplatedURLWrapper : Codable {
101
- let url : TemplatedURL ?
101
+ let url : URLTemplate ?
102
102
}
0 commit comments