Skip to content

Commit

Permalink
Update test runners
Browse files Browse the repository at this point in the history
  • Loading branch information
marcprux committed Jan 7, 2024
1 parent 1feff5a commit 9aac5c9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
14 changes: 10 additions & 4 deletions Sources/FireSide/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ let fireSide = try! FireSideStore()

public struct ContentView: View {
@AppStorage("setting") var setting = true
@AppStorage("selectedTab") var selectedTab = 0

public init() {
}

public var body: some View {
TabView() {
TabView(selection: $selectedTab) {
JoinChatView()
.tag(0)
.tabItem { Label("Welcome", systemImage: "star") }
Expand Down Expand Up @@ -43,12 +44,14 @@ public struct ContentView: View {
.font(.largeTitle)
Toggle("Option", isOn: $setting)
}
.tag(1)
.tag(2)
.tabItem { Label("Settings", systemImage: "gearshape.fill") }
}
}
}

let chatKeyCount = 8

struct JoinChatView : View {
@AppStorage("chatKey") var chatKey: String = ""
@State var lastError: String? = nil
Expand Down Expand Up @@ -77,7 +80,7 @@ struct JoinChatView : View {
.frame(width: 250.0, height: 180.0)
}
.buttonStyle(.borderedProminent)
.disabled(chatKey.isEmpty == false && chatKey.count != 8)
.disabled(chatKey.isEmpty == false && chatKey.count != chatKeyCount)


Text(lastError ?? "")
Expand All @@ -103,12 +106,15 @@ struct JoinChatView : View {
private func joinChat() async {
do {
self.lastError = nil // clear the most recent error
if chatKey.count == 8 {
if chatKey.count == chatKeyCount {
logger.log("joinChat: \(chatKey)")
try await fireSide.joinChat(chatKey: chatKey)
} else {
logger.log("startNewChat")
chatKey = try await fireSide.startNewChat()
}
} catch {
logger.log("joinChat error: \(error)")
self.lastError = error.localizedDescription
}
}
Expand Down
1 change: 1 addition & 0 deletions Tests/FireSideModelTests/FireSideModelTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import Foundation

let logger: Logger = Logger(subsystem: "FireSideModel", category: "Tests")

// SKIP INSERT: @org.junit.runner.RunWith(androidx.test.ext.junit.runners.AndroidJUnit4::class)
@available(macOS 13, *)
final class FireSideModelTests: XCTestCase {
// values from Darwin/GoogleService-Info.plist
Expand Down
3 changes: 2 additions & 1 deletion Tests/FireSideTests/FireSideTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import Foundation

let logger: Logger = Logger(subsystem: "FireSide", category: "Tests")

// SKIP INSERT: @org.junit.runner.RunWith(androidx.test.ext.junit.runners.AndroidJUnit4::class)
@available(macOS 13, *)
final class FireSideTests: XCTestCase {
func testFireSide() throws {
Expand All @@ -20,4 +21,4 @@ final class FireSideTests: XCTestCase {

struct TestData : Codable, Hashable {
var testModuleName: String
}
}

0 comments on commit 9aac5c9

Please sign in to comment.