Skip to content

Commit 876b975

Browse files
committed
Throw on nil value
1 parent 18d8382 commit 876b975

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

WordPress/WordPressTest/BlockEditorSettingsServiceTests.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class BlockEditorSettingsServiceTests: CoreDataTestCase {
2424
}
2525

2626
// MARK: Editor `theme_supports` support
27-
func testThemeSupportsNewTheme() {
27+
func testThemeSupportsNewTheme() throws {
2828
blog = BlogBuilder(mainContext)
2929
.with(wordPressVersion: "5.7")
3030
.with(isHostedAtWPCom: true)
@@ -49,11 +49,11 @@ class BlockEditorSettingsServiceTests: CoreDataTestCase {
4949
}
5050

5151
waitForExpectations(timeout: expectationTimeout)
52-
validateThemeResponse()
52+
try validateThemeResponse()
5353
XCTAssertNotNil(self.blog.blockEditorSettings?.checksum)
5454
}
5555

56-
func testThemeSupportsThemeChange() {
56+
func testThemeSupportsThemeChange() throws {
5757
blog = BlogBuilder(mainContext)
5858
.with(wordPressVersion: "5.7")
5959
.with(isHostedAtWPCom: true)
@@ -82,11 +82,11 @@ class BlockEditorSettingsServiceTests: CoreDataTestCase {
8282
}
8383

8484
waitForExpectations(timeout: expectationTimeout)
85-
validateThemeResponse()
85+
try validateThemeResponse()
8686
XCTAssertNotEqual(self.blog.blockEditorSettings?.checksum, originalChecksum)
8787
}
8888

89-
func testThemeSupportsThemeIsTheSame() {
89+
func testThemeSupportsThemeIsTheSame() throws {
9090
blog = BlogBuilder(mainContext)
9191
.with(wordPressVersion: "5.7")
9292
.with(isHostedAtWPCom: true)
@@ -115,13 +115,13 @@ class BlockEditorSettingsServiceTests: CoreDataTestCase {
115115
}
116116

117117
waitForExpectations(timeout: expectationTimeout)
118-
validateThemeResponse()
118+
try validateThemeResponse()
119119
XCTAssertEqual(self.blog.blockEditorSettings?.checksum, originalChecksum)
120120
}
121121

122-
private func validateThemeResponse() {
123-
XCTAssertGreaterThan(self.blog.blockEditorSettings!.colors!.count, 0)
124-
XCTAssertGreaterThan(self.blog.blockEditorSettings!.gradients!.count, 0)
122+
private func validateThemeResponse() throws {
123+
try XCTAssertGreaterThan(XCTUnwrap(self.blog.blockEditorSettings?.colors?.count), 0)
124+
try XCTAssertGreaterThan(XCTUnwrap(self.blog.blockEditorSettings?.gradients?.count), 0)
125125
}
126126

127127
private func stubThemeRequest(response: HTTPStubsResponse) {

0 commit comments

Comments
 (0)