-
Notifications
You must be signed in to change notification settings - Fork 328
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor external bus messages and add tests for it
- Loading branch information
Showing
5 changed files
with
118 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
Sources/App/WebView/Tests/WebViewExternalBusMessageTests.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
@testable import HomeAssistant | ||
import XCTest | ||
final class WebViewExternalBusMessageTests: XCTestCase { | ||
func test_externalBus_messageKeys() { | ||
XCTAssertEqual(WebViewExternalBusMessage.configGet.rawValue, "config/get") | ||
XCTAssertEqual(WebViewExternalBusMessage.configScreenShow.rawValue, "config_screen/show") | ||
XCTAssertEqual(WebViewExternalBusMessage.haptic.rawValue, "haptic") | ||
XCTAssertEqual(WebViewExternalBusMessage.connectionStatus.rawValue, "connection-status") | ||
XCTAssertEqual(WebViewExternalBusMessage.tagRead.rawValue, "tag/read") | ||
XCTAssertEqual(WebViewExternalBusMessage.tagWrite.rawValue, "tag/write") | ||
XCTAssertEqual(WebViewExternalBusMessage.themeUpdate.rawValue, "theme-update") | ||
XCTAssertEqual(WebViewExternalBusMessage.matterCommission.rawValue, "matter/commission") | ||
XCTAssertEqual(WebViewExternalBusMessage.threadImportCredentials.rawValue, "thread/import_credentials") | ||
|
||
XCTAssertEqual(WebViewExternalBusMessage.allCases.count, 9) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import Foundation | ||
|
||
enum WebViewExternalBusMessage: String, CaseIterable { | ||
case configGet = "config/get" | ||
case configScreenShow = "config_screen/show" | ||
case haptic | ||
case connectionStatus = "connection-status" | ||
case tagRead = "tag/read" | ||
case tagWrite = "tag/write" | ||
case themeUpdate = "theme-update" | ||
case matterCommission = "matter/commission" | ||
case threadImportCredentials = "thread/import_credentials" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters