forked from JohnSundell/Plot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SiteMapTests.swift
65 lines (56 loc) · 1.67 KB
/
SiteMapTests.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/**
* Plot
* Copyright (c) John Sundell 2019
* MIT license, see LICENSE file for details
*/
import XCTest
import Plot
final class SiteMapTests: XCTestCase {
func testEmptyMap() {
let map = SiteMap()
assertEqualSiteMapContent(map, "")
}
func testDailyUpdatedLocation() throws {
let dateStubs = try Date.makeStubs(withFormattingStyle: .siteMap)
let map = SiteMap(.url(
.loc("url.com"),
.changefreq(.daily),
.priority(1.0),
.lastmod(dateStubs.date, timeZone: dateStubs.timeZone)
))
assertEqualSiteMapContent(map, """
<url>\
<loc>url.com</loc>\
<changefreq>daily</changefreq>\
<priority>1.0</priority>\
<lastmod>\(dateStubs.expectedString)</lastmod>\
</url>
""")
}
func testMonthlyUpdatedLocation() throws {
let dateStubs = try Date.makeStubs(withFormattingStyle: .siteMap)
let map = SiteMap(.url(
.loc("url.com"),
.changefreq(.monthly),
.priority(1.0),
.lastmod(dateStubs.date, timeZone: dateStubs.timeZone)
))
assertEqualSiteMapContent(map, """
<url>\
<loc>url.com</loc>\
<changefreq>monthly</changefreq>\
<priority>1.0</priority>\
<lastmod>\(dateStubs.expectedString)</lastmod>\
</url>
""")
}
}
extension SiteMapTests {
static var allTests: Linux.TestList<SiteMapTests> {
[
("testEmptyMap", testEmptyMap),
("testDailyUpdatedLocation", testDailyUpdatedLocation),
("testMonthlyUpdatedLocation", testMonthlyUpdatedLocation)
]
}
}