@@ -38,15 +38,15 @@ private extension DependenciesProvider {
38
38
39
39
@Suite ( . dependencies( . default) ) struct WebpageSnapshotTests {
40
40
41
- @Test func HomeIndexView_document ( ) throws {
41
+ @Test func HomeIndex_document ( ) throws {
42
42
Supporters . mock ( )
43
43
44
44
let page = { HomeIndex . View ( path: " / " , model: . mock) . document ( ) }
45
45
46
46
assertSnapshot ( of: page, as: . html)
47
47
}
48
48
49
- @Test func HomeIndexView_document_development ( ) throws {
49
+ @Test func HomeIndex_document_development ( ) throws {
50
50
// Test home page to ensure the dev environment is showing the dev banner and `noindex` for robots
51
51
withDependencies {
52
52
$0. environment. current = { . development }
@@ -59,7 +59,7 @@ private extension DependenciesProvider {
59
59
}
60
60
}
61
61
62
- @Test func MaintenanceMessageIndexView_document ( ) throws {
62
+ @Test func MaintenanceMessageIndex_document ( ) throws {
63
63
let maintenanceMessage = """
64
64
# Server Maintenance
65
65
@@ -74,15 +74,15 @@ private extension DependenciesProvider {
74
74
assertSnapshot ( of: page, as: . html)
75
75
}
76
76
77
- @Test func PackageShowView_document ( ) throws {
77
+ @Test func PackageShow_document ( ) throws {
78
78
var model = API . PackageController. GetRoute. Model. mock
79
79
model. homepageUrl = " https://swiftpackageindex.com/ "
80
80
let page = { PackageShow . View ( path: " " , model: model, packageSchema: . mock) . document ( ) }
81
81
82
82
assertSnapshot ( of: page, as: . html)
83
83
}
84
84
85
- @Test func PackageShowView_document_binary_targets ( ) throws {
85
+ @Test func PackageShow_document_binary_targets ( ) throws {
86
86
var model = API . PackageController. GetRoute. Model. mock
87
87
model. homepageUrl = " https://swiftpackageindex.com/ "
88
88
model. hasBinaryTargets = true
@@ -92,7 +92,7 @@ private extension DependenciesProvider {
92
92
assertSnapshot ( of: page, as: . html)
93
93
}
94
94
95
- @Test func PackageShowView_document_few_keywords ( ) throws {
95
+ @Test func PackageShow_document_few_keywords ( ) throws {
96
96
var model = API . PackageController. GetRoute. Model. mock
97
97
let keywordsWithCounts = [ ( " tag1 " , 1 ) ,
98
98
( " tag2 " , 10 ) ,
@@ -108,7 +108,7 @@ private extension DependenciesProvider {
108
108
assertSnapshot ( of: page, as: . html)
109
109
}
110
110
111
- @Test func PackageShowView_document_many_keywords ( ) throws {
111
+ @Test func PackageShow_document_many_keywords ( ) throws {
112
112
var model = API . PackageController. GetRoute. Model. mock
113
113
let keywordsWithCounts = [ ( " tag1 " , 1 ) , ( " tag2 " , 10 ) , ( " tag3 " , 100 ) , ( " tag4 " , 1000 ) , ( " tag5 " , 1234 ) ,
114
114
( " tag6 " , 1250 ) , ( " tag7 " , 1249 ) , ( " tag8 " , 1251 ) , ( " tag9 " , 12345 ) ,
@@ -131,7 +131,7 @@ private extension DependenciesProvider {
131
131
assertSnapshot ( of: page, as: . html)
132
132
}
133
133
134
- @Test func PackageShowView_document_emoji_summary ( ) throws {
134
+ @Test func PackageShow_document_emoji_summary ( ) throws {
135
135
var model = API . PackageController. GetRoute. Model. mock
136
136
model. summary = " :package: Nothing but Cache. :octocat: "
137
137
@@ -140,7 +140,7 @@ private extension DependenciesProvider {
140
140
assertSnapshot ( of: page, as: . html)
141
141
}
142
142
143
- @Test func PackageShowView_document_open_source_license ( ) throws {
143
+ @Test func PackageShow_document_open_source_license ( ) throws {
144
144
var model = API . PackageController. GetRoute. Model. mock
145
145
model. license = . mit
146
146
model. licenseUrl = " https://example.com/license.html "
@@ -149,7 +149,7 @@ private extension DependenciesProvider {
149
149
assertSnapshot ( of: page, as: . html)
150
150
}
151
151
152
- @Test func PackageShowView_document_app_store_incompatible_license ( ) throws {
152
+ @Test func PackageShow_document_app_store_incompatible_license ( ) throws {
153
153
var model = API . PackageController. GetRoute. Model. mock
154
154
model. license = . gpl_3_0
155
155
model. licenseUrl = " https://example.com/license.html "
@@ -158,7 +158,7 @@ private extension DependenciesProvider {
158
158
assertSnapshot ( of: page, as: . html)
159
159
}
160
160
161
- @Test func PackageShowView_document_other_license ( ) throws {
161
+ @Test func PackageShow_document_other_license ( ) throws {
162
162
var model = API . PackageController. GetRoute. Model. mock
163
163
model. license = . other
164
164
model. licenseUrl = " https://example.com/license.html "
@@ -167,7 +167,7 @@ private extension DependenciesProvider {
167
167
assertSnapshot ( of: page, as: . html)
168
168
}
169
169
170
- @Test func PackageShowView_document_no_license ( ) throws {
170
+ @Test func PackageShow_document_no_license ( ) throws {
171
171
var model = API . PackageController. GetRoute. Model. mock
172
172
model. license = . none
173
173
model. licenseUrl = nil
@@ -176,7 +176,7 @@ private extension DependenciesProvider {
176
176
assertSnapshot ( of: page, as: . html)
177
177
}
178
178
179
- @Test func PackageShowView_document_no_authors_activity ( ) throws {
179
+ @Test func PackageShow_document_no_authors_activity ( ) throws {
180
180
// Test to ensure we don't display empty bullet points when there is
181
181
// no author or activity info
182
182
var model = API . PackageController. GetRoute. Model. mock
@@ -187,7 +187,7 @@ private extension DependenciesProvider {
187
187
assertSnapshot ( of: page, as: . html)
188
188
}
189
189
190
- @Test func PackageShowView_document_withPackageFundingLinks ( ) throws {
190
+ @Test func PackageShow_document_withPackageFundingLinks ( ) throws {
191
191
var model = API . PackageController. GetRoute. Model. mock
192
192
model. fundingLinks = [
193
193
. init( platform: . gitHub, url: " https://github.com/sponsor-url " ) ,
@@ -200,15 +200,15 @@ private extension DependenciesProvider {
200
200
assertSnapshot ( of: page, as: . html)
201
201
}
202
202
203
- @Test func PackageShowView_document_with_documentation_link ( ) throws {
203
+ @Test func PackageShow_document_with_documentation_link ( ) throws {
204
204
var model = API . PackageController. GetRoute. Model. mock
205
205
model. documentationTarget = . internal( docVersion: . reference( " main " ) , archive: " archive " )
206
206
let page = { PackageShow . View ( path: " " , model: model, packageSchema: . mock) . document ( ) }
207
207
208
208
assertSnapshot ( of: page, as: . html)
209
209
}
210
210
211
- @Test func PackageShowView_document_single_row_tables ( ) throws {
211
+ @Test func PackageShow_document_single_row_tables ( ) throws {
212
212
// Test display when all three significant version collapse to a single row
213
213
var model = API . PackageController. GetRoute. Model. mock
214
214
do {
@@ -240,7 +240,7 @@ private extension DependenciesProvider {
240
240
assertSnapshot ( of: page, as: . html)
241
241
}
242
242
243
- @Test func PackageShowView_document_no_builds ( ) throws {
243
+ @Test func PackageShow_document_no_builds ( ) throws {
244
244
// Test display when there are no builds
245
245
var model = API . PackageController. GetRoute. Model. mock
246
246
model. swiftVersionBuildInfo = . init( stable: nil , beta: nil , latest: nil )
@@ -250,7 +250,7 @@ private extension DependenciesProvider {
250
250
assertSnapshot ( of: page, as: . html)
251
251
}
252
252
253
- @Test func PackageShowView_document_canonicalURL_noImageSnapshots ( ) throws {
253
+ @Test func PackageShow_document_canonicalURL_noImageSnapshots ( ) throws {
254
254
// In production, the owner and repository name in the view model are fetched from
255
255
// the database and have canonical capitalisation.
256
256
var model = API . PackageController. GetRoute. Model. mock
@@ -261,20 +261,20 @@ private extension DependenciesProvider {
261
261
assertSnapshot ( of: page, as: . html)
262
262
}
263
263
264
- @Test func PackageShowView_document_missingPackage ( ) throws {
264
+ @Test func MissingPackage_document ( ) throws {
265
265
let page = { MissingPackage . View ( path: " " , model: . mock) . document ( ) }
266
266
assertSnapshot ( of: page, as: . html)
267
267
}
268
268
269
- @Test func PackageReadmeView_document ( ) throws {
269
+ @Test func PackageReadme_document ( ) throws {
270
270
let model = PackageReadme . Model. mock
271
271
let page = { PackageReadme . View ( model: model) . document ( ) }
272
272
273
273
assertSnapshot ( of: page, as: . html)
274
274
}
275
275
276
276
// Note: This snapshot test deliberately omits an image snapshot as the HTML being tested has no explicit styling.
277
- @Test func PackageReadmeView_document_unparseableReadme_noImageSnapshots ( ) throws {
277
+ @Test func PackageReadme_document_unparseableReadme_noImageSnapshots ( ) throws {
278
278
let model = PackageReadme . Model ( url: " https://example.com/owner/repo/README " ,
279
279
repositoryOwner: " owner " ,
280
280
repositoryName: " repo " ,
@@ -286,14 +286,14 @@ private extension DependenciesProvider {
286
286
}
287
287
288
288
// Note: This snapshot test deliberately omits an image snapshot as the HTML being tested has no explicit styling.
289
- @Test func PackageReadmeView_document_noReadme_noImageSnapshots ( ) throws {
289
+ @Test func PackageReadme_document_noReadme_noImageSnapshots ( ) throws {
290
290
let model = PackageReadme . Model. noReadme
291
291
let page = { PackageReadme . View ( model: model) . document ( ) }
292
292
293
293
assertSnapshot ( of: page, as: . html)
294
294
}
295
295
296
- @Test func PackageShowView_document_customCollection ( ) throws {
296
+ @Test func PackageShow_document_customCollection ( ) throws {
297
297
var model = API . PackageController. GetRoute. Model. mock
298
298
model. homepageUrl = " https://swiftpackageindex.com/ "
299
299
model. customCollections = [ . init( key: " custom-collection " ,
@@ -304,20 +304,20 @@ private extension DependenciesProvider {
304
304
assertSnapshot ( of: page, as: . html)
305
305
}
306
306
307
- @Test func PackageReleasesView_document ( ) throws {
307
+ @Test func PackageReleases_document ( ) throws {
308
308
let model = PackageReleases . Model. mock
309
309
let page = { PackageReleases . View ( model: model) . document ( ) }
310
310
311
311
assertSnapshot ( of: page, as: . html)
312
312
}
313
313
314
- @Test func PackageReleasesView_document_NoModel ( ) throws {
314
+ @Test func PackageReleases_document_NoModel ( ) throws {
315
315
let page = { PackageReleases . View ( model: nil ) . document ( ) }
316
316
317
317
assertSnapshot ( of: page, as: . html)
318
318
}
319
319
320
- @Test func ErrorPageView_document ( ) throws {
320
+ @Test func ErrorPage_document ( ) throws {
321
321
let page = { ErrorPage . View ( path: " " , error: Abort ( . notFound) ) . document ( ) }
322
322
323
323
assertSnapshot ( of: page, as: . html)
0 commit comments