Skip to content

Commit 4ffe814

Browse files
authored
swiftui-snapshot-testing deprecation: use assertSnapshot(of:…) (gonzalezreal#284)
1 parent 8f6affc commit 4ffe814

File tree

4 files changed

+33
-33
lines changed

4 files changed

+33
-33
lines changed

Tests/MarkdownUITests/MarkdownImageTests.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
.border(Color.accentColor)
2222
.padding()
2323

24-
assertSnapshot(matching: view, as: .image(layout: layout))
24+
assertSnapshot(of: view, as: .image(layout: layout))
2525
}
2626

2727
func testRelativeImage() {
@@ -49,7 +49,7 @@
4949
)
5050
)
5151

52-
assertSnapshot(matching: view, as: .image(layout: layout))
52+
assertSnapshot(of: view, as: .image(layout: layout))
5353
}
5454

5555
func testImageLink() {
@@ -66,7 +66,7 @@
6666
.padding()
6767
.markdownImageProvider(AssetImageProvider(bundle: .module))
6868

69-
assertSnapshot(matching: view, as: .image(layout: layout))
69+
assertSnapshot(of: view, as: .image(layout: layout))
7070
}
7171

7272
func testMultipleImages() throws {
@@ -89,7 +89,7 @@
8989
.padding()
9090
.markdownImageProvider(AssetImageProvider(bundle: .module))
9191

92-
assertSnapshot(matching: view, as: .image(layout: layout))
92+
assertSnapshot(of: view, as: .image(layout: layout))
9393
}
9494

9595
func testMultipleImagesSize() throws {
@@ -109,7 +109,7 @@
109109
.padding()
110110
.markdownImageProvider(AssetImageProvider(bundle: .module))
111111

112-
assertSnapshot(matching: view, as: .image(layout: layout))
112+
assertSnapshot(of: view, as: .image(layout: layout))
113113
}
114114

115115
func testColorScheme() {
@@ -136,7 +136,7 @@
136136
}
137137
.markdownImageProvider(AssetImageProvider(bundle: .module))
138138

139-
assertSnapshot(matching: view, as: .image(layout: layout))
139+
assertSnapshot(of: view, as: .image(layout: layout))
140140
}
141141
}
142142
#endif

Tests/MarkdownUITests/MarkdownListTests.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
.border(Color.accentColor)
2020
.padding()
2121

22-
assertSnapshot(matching: view, as: .image(layout: layout))
22+
assertSnapshot(of: view, as: .image(layout: layout))
2323
}
2424

2525
func testBulletedList() {
@@ -36,7 +36,7 @@
3636
.border(Color.accentColor)
3737
.padding()
3838

39-
assertSnapshot(matching: view, as: .image(layout: layout))
39+
assertSnapshot(of: view, as: .image(layout: layout))
4040
}
4141

4242
func testBulletedDashedList() {
@@ -54,7 +54,7 @@
5454
.padding()
5555
.markdownBulletedListMarker(.dash)
5656

57-
assertSnapshot(matching: view, as: .image(layout: layout))
57+
assertSnapshot(of: view, as: .image(layout: layout))
5858
}
5959

6060
func testNumberedList() {
@@ -81,7 +81,7 @@
8181
.border(Color.accentColor)
8282
.padding()
8383

84-
assertSnapshot(matching: view, as: .image(layout: layout))
84+
assertSnapshot(of: view, as: .image(layout: layout))
8585
}
8686

8787
func testRomanNumberedList() {
@@ -103,7 +103,7 @@
103103
.padding()
104104
.markdownNumberedListMarker(.lowerRoman)
105105

106-
assertSnapshot(matching: view, as: .image(layout: layout))
106+
assertSnapshot(of: view, as: .image(layout: layout))
107107
}
108108

109109
func testLooseList() {
@@ -129,7 +129,7 @@
129129
.border(Color.accentColor)
130130
.padding()
131131

132-
assertSnapshot(matching: view, as: .image(layout: layout))
132+
assertSnapshot(of: view, as: .image(layout: layout))
133133
}
134134
}
135135

Tests/MarkdownUITests/MarkdownTests.swift

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
.border(Color.accentColor)
3535
.padding()
3636

37-
assertSnapshot(matching: view, as: .image(layout: layout))
37+
assertSnapshot(of: view, as: .image(layout: layout))
3838
}
3939

4040
func testCodeBlock() {
@@ -60,7 +60,7 @@
6060
.border(Color.accentColor)
6161
.padding()
6262

63-
assertSnapshot(matching: view, as: .image(layout: layout))
63+
assertSnapshot(of: view, as: .image(layout: layout))
6464
}
6565

6666
func testVerbatimHTML() {
@@ -79,7 +79,7 @@
7979
.border(Color.accentColor)
8080
.padding()
8181

82-
assertSnapshot(matching: view, as: .image(layout: layout))
82+
assertSnapshot(of: view, as: .image(layout: layout))
8383
}
8484

8585
func testOpenCodeBlock() {
@@ -93,7 +93,7 @@
9393
.border(Color.accentColor)
9494
.padding()
9595

96-
assertSnapshot(matching: view, as: .image(layout: layout))
96+
assertSnapshot(of: view, as: .image(layout: layout))
9797
}
9898

9999
func testParagraphs() {
@@ -111,7 +111,7 @@
111111
.border(Color.accentColor)
112112
.padding()
113113

114-
assertSnapshot(matching: view, as: .image(layout: layout))
114+
assertSnapshot(of: view, as: .image(layout: layout))
115115
}
116116

117117
func testCenteredParagraphs() {
@@ -130,7 +130,7 @@
130130
.padding()
131131
.multilineTextAlignment(.center)
132132

133-
assertSnapshot(matching: view, as: .image(layout: layout))
133+
assertSnapshot(of: view, as: .image(layout: layout))
134134
}
135135

136136
func testTrailingParagraphs() {
@@ -149,7 +149,7 @@
149149
.padding()
150150
.multilineTextAlignment(.trailing)
151151

152-
assertSnapshot(matching: view, as: .image(layout: layout))
152+
assertSnapshot(of: view, as: .image(layout: layout))
153153
}
154154

155155
func testSpacing() {
@@ -171,7 +171,7 @@
171171
.markdownMargin(bottom: .zero)
172172
}
173173

174-
assertSnapshot(matching: view, as: .image(layout: layout))
174+
assertSnapshot(of: view, as: .image(layout: layout))
175175
}
176176

177177
func testHeadings() {
@@ -194,7 +194,7 @@
194194
.border(Color.accentColor)
195195
.padding()
196196

197-
assertSnapshot(matching: view, as: .image(layout: layout))
197+
assertSnapshot(of: view, as: .image(layout: layout))
198198
}
199199

200200
func testThematicBreak() {
@@ -220,7 +220,7 @@
220220
.border(Color.accentColor)
221221
.padding()
222222

223-
assertSnapshot(matching: view, as: .image(layout: layout))
223+
assertSnapshot(of: view, as: .image(layout: layout))
224224
}
225225

226226
func testInlines() {
@@ -250,7 +250,7 @@
250250
.border(Color.accentColor)
251251
.padding()
252252

253-
assertSnapshot(matching: view, as: .image(layout: layout))
253+
assertSnapshot(of: view, as: .image(layout: layout))
254254
}
255255

256256
func testInlinesStyling() {
@@ -294,7 +294,7 @@
294294
UnderlineStyle(.init(pattern: .dot))
295295
}
296296

297-
assertSnapshot(matching: view, as: .image(layout: layout))
297+
assertSnapshot(of: view, as: .image(layout: layout))
298298
}
299299
}
300300
#endif

Tests/MarkdownUITests/ThemeDocCTests.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
Use `git status` to list all new or modified files that haven't yet been committed.
2525
"""#
2626
}
27-
assertSnapshot(matching: view, as: .image(layout: layout))
27+
assertSnapshot(of: view, as: .image(layout: layout))
2828
}
2929

3030
func testHeadings() {
@@ -45,7 +45,7 @@
4545
Paragraph.
4646
"""#
4747
}
48-
assertSnapshot(matching: view, as: .image(layout: layout))
48+
assertSnapshot(of: view, as: .image(layout: layout))
4949
}
5050

5151
func testParagraph() {
@@ -60,7 +60,7 @@
6060
It was a bright cold day in April, and the clocks were striking thirteen.
6161
"""#
6262
}
63-
assertSnapshot(matching: view, as: .image(layout: layout))
63+
assertSnapshot(of: view, as: .image(layout: layout))
6464
}
6565

6666
func testBlockquote() {
@@ -73,7 +73,7 @@
7373
It was a bright cold day in April, and the clocks were striking thirteen.
7474
"""#
7575
}
76-
assertSnapshot(matching: view, as: .image(layout: layout))
76+
assertSnapshot(of: view, as: .image(layout: layout))
7777
}
7878

7979
func testCodeBlock() {
@@ -93,7 +93,7 @@
9393
It was a bright cold day in April, and the clocks were striking thirteen.
9494
"""#
9595
}
96-
assertSnapshot(matching: view, as: .image(layout: layout))
96+
assertSnapshot(of: view, as: .image(layout: layout))
9797
}
9898

9999
func testImage() throws {
@@ -116,7 +116,7 @@
116116
"""#
117117
}
118118
.markdownImageProvider(AssetImageProvider(bundle: .module))
119-
assertSnapshot(matching: view, as: .image(layout: layout))
119+
assertSnapshot(of: view, as: .image(layout: layout))
120120
}
121121

122122
func testList() {
@@ -143,7 +143,7 @@
143143
- [ ] An unfinished task
144144
"""#
145145
}
146-
assertSnapshot(matching: view, as: .image(layout: layout))
146+
assertSnapshot(of: view, as: .image(layout: layout))
147147
}
148148

149149
func testTable() throws {
@@ -162,7 +162,7 @@
162162
| `fast` | Moves faster than a hare. |
163163
"""#
164164
}
165-
assertSnapshot(matching: view, as: .image(layout: layout))
165+
assertSnapshot(of: view, as: .image(layout: layout))
166166
}
167167

168168
func testThematicBreak() {
@@ -175,7 +175,7 @@
175175
It was a bright cold day in April, and the clocks were striking thirteen.
176176
"""#
177177
}
178-
assertSnapshot(matching: view, as: .image(layout: layout))
178+
assertSnapshot(of: view, as: .image(layout: layout))
179179
}
180180
}
181181

0 commit comments

Comments
 (0)