-
-
Notifications
You must be signed in to change notification settings - Fork 1
Improve CI workflows and expand test coverage #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
corvid-agent
wants to merge
2
commits into
0xLeif:main
Choose a base branch
from
corvid-agent:ci/cross-platform-workflows-and-test-coverage
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 | ||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -136,3 +136,213 @@ func testDismissConfirmationDialog() { | |||||||||||||||||||||||||||||||||||||||||||||
| navigator.dismiss() | ||||||||||||||||||||||||||||||||||||||||||||||
| #expect(navigator.confirmDialog == nil, "Navigator confirmation dialog should be nil after dismissal.") | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| // MARK: - Path Management Tests | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| @Test("Remove Last with Explicit Count") | ||||||||||||||||||||||||||||||||||||||||||||||
| @MainActor | ||||||||||||||||||||||||||||||||||||||||||||||
| func testRemoveLastWithCount() { | ||||||||||||||||||||||||||||||||||||||||||||||
| let navigator = Navigator() | ||||||||||||||||||||||||||||||||||||||||||||||
| navigator.append("Path1") | ||||||||||||||||||||||||||||||||||||||||||||||
| navigator.append("Path2") | ||||||||||||||||||||||||||||||||||||||||||||||
| navigator.append("Path3") | ||||||||||||||||||||||||||||||||||||||||||||||
| navigator.removeLast(2) | ||||||||||||||||||||||||||||||||||||||||||||||
| #expect(navigator.path.count == 1, "removeLast(2) should remove exactly two elements.") | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| @Test("Multiple Appends") | ||||||||||||||||||||||||||||||||||||||||||||||
| @MainActor | ||||||||||||||||||||||||||||||||||||||||||||||
| func testMultipleAppends() { | ||||||||||||||||||||||||||||||||||||||||||||||
| let navigator = Navigator() | ||||||||||||||||||||||||||||||||||||||||||||||
| navigator.append("A") | ||||||||||||||||||||||||||||||||||||||||||||||
| navigator.append("B") | ||||||||||||||||||||||||||||||||||||||||||||||
| navigator.append("C") | ||||||||||||||||||||||||||||||||||||||||||||||
| #expect(navigator.path.count == 3, "Navigator path should contain three elements after three appends.") | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| @Test("Remove Last Default Count") | ||||||||||||||||||||||||||||||||||||||||||||||
| @MainActor | ||||||||||||||||||||||||||||||||||||||||||||||
| func testRemoveLastDefaultCount() { | ||||||||||||||||||||||||||||||||||||||||||||||
| let navigator = Navigator() | ||||||||||||||||||||||||||||||||||||||||||||||
| navigator.append("A") | ||||||||||||||||||||||||||||||||||||||||||||||
| navigator.append("B") | ||||||||||||||||||||||||||||||||||||||||||||||
| navigator.removeLast() | ||||||||||||||||||||||||||||||||||||||||||||||
| #expect(navigator.path.count == 1, "removeLast() should remove exactly one element by default.") | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| // MARK: - Dismiss Priority Tests | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| @Test("Dismiss Prioritizes Alert over Confirm Dialog") | ||||||||||||||||||||||||||||||||||||||||||||||
| @MainActor | ||||||||||||||||||||||||||||||||||||||||||||||
| func testDismissPrioritizesAlertOverConfirmDialog() { | ||||||||||||||||||||||||||||||||||||||||||||||
| let navigator = Navigator() | ||||||||||||||||||||||||||||||||||||||||||||||
| navigator.confirmDialog( | ||||||||||||||||||||||||||||||||||||||||||||||
| title: "Dialog", | ||||||||||||||||||||||||||||||||||||||||||||||
| message: { Text("Message") }, | ||||||||||||||||||||||||||||||||||||||||||||||
| actions: { EmptyView() } | ||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||
| navigator.alert( | ||||||||||||||||||||||||||||||||||||||||||||||
| title: "Alert", | ||||||||||||||||||||||||||||||||||||||||||||||
| message: { Text("Alert Message") }, | ||||||||||||||||||||||||||||||||||||||||||||||
| actions: { EmptyView() } | ||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||
| #expect(navigator.alert != nil) | ||||||||||||||||||||||||||||||||||||||||||||||
| #expect(navigator.confirmDialog != nil) | ||||||||||||||||||||||||||||||||||||||||||||||
| navigator.dismiss() | ||||||||||||||||||||||||||||||||||||||||||||||
| #expect(navigator.alert == nil, "Dismiss should clear alert first.") | ||||||||||||||||||||||||||||||||||||||||||||||
| #expect(navigator.confirmDialog != nil, "Confirm dialog should remain after dismissing alert.") | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| @Test("Dismiss Prioritizes Confirm Dialog over Sheet") | ||||||||||||||||||||||||||||||||||||||||||||||
| @MainActor | ||||||||||||||||||||||||||||||||||||||||||||||
| func testDismissPrioritizesConfirmDialogOverSheet() { | ||||||||||||||||||||||||||||||||||||||||||||||
| let navigator = Navigator() | ||||||||||||||||||||||||||||||||||||||||||||||
| navigator.sheet { Text("Sheet") } | ||||||||||||||||||||||||||||||||||||||||||||||
| navigator.confirmDialog( | ||||||||||||||||||||||||||||||||||||||||||||||
| title: "Dialog", | ||||||||||||||||||||||||||||||||||||||||||||||
| message: { Text("Message") }, | ||||||||||||||||||||||||||||||||||||||||||||||
| actions: { EmptyView() } | ||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||
| #expect(navigator.sheet != nil) | ||||||||||||||||||||||||||||||||||||||||||||||
| #expect(navigator.confirmDialog != nil) | ||||||||||||||||||||||||||||||||||||||||||||||
| navigator.dismiss() | ||||||||||||||||||||||||||||||||||||||||||||||
| #expect(navigator.confirmDialog == nil, "Dismiss should clear confirm dialog first.") | ||||||||||||||||||||||||||||||||||||||||||||||
| #expect(navigator.sheet != nil, "Sheet should remain after dismissing confirm dialog.") | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| @Test("Dismiss Prioritizes Sheet over Path") | ||||||||||||||||||||||||||||||||||||||||||||||
| @MainActor | ||||||||||||||||||||||||||||||||||||||||||||||
| func testDismissPrioritizesSheetOverPath() { | ||||||||||||||||||||||||||||||||||||||||||||||
| let navigator = Navigator() | ||||||||||||||||||||||||||||||||||||||||||||||
| navigator.append("Path1") | ||||||||||||||||||||||||||||||||||||||||||||||
| navigator.sheet { Text("Sheet") } | ||||||||||||||||||||||||||||||||||||||||||||||
| #expect(navigator.sheet != nil) | ||||||||||||||||||||||||||||||||||||||||||||||
| #expect(navigator.path.count == 1) | ||||||||||||||||||||||||||||||||||||||||||||||
| navigator.dismiss() | ||||||||||||||||||||||||||||||||||||||||||||||
| #expect(navigator.sheet == nil, "Dismiss should clear sheet first.") | ||||||||||||||||||||||||||||||||||||||||||||||
| #expect(navigator.path.count == 1, "Path should remain after dismissing sheet.") | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| @Test("Dismiss Falls Through to Path") | ||||||||||||||||||||||||||||||||||||||||||||||
| @MainActor | ||||||||||||||||||||||||||||||||||||||||||||||
| func testDismissFallsThroughToPath() { | ||||||||||||||||||||||||||||||||||||||||||||||
| let navigator = Navigator() | ||||||||||||||||||||||||||||||||||||||||||||||
| navigator.append("Path1") | ||||||||||||||||||||||||||||||||||||||||||||||
| navigator.append("Path2") | ||||||||||||||||||||||||||||||||||||||||||||||
| navigator.dismiss() | ||||||||||||||||||||||||||||||||||||||||||||||
| #expect(navigator.path.count == 1, "Dismiss should remove last path element when no dialogs are present.") | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| // MARK: - Pop to Root with Active Dialogs | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| @Test("Pop to Root Clears All Active Dialogs") | ||||||||||||||||||||||||||||||||||||||||||||||
| @MainActor | ||||||||||||||||||||||||||||||||||||||||||||||
| func testPopToRootClearsAllDialogs() { | ||||||||||||||||||||||||||||||||||||||||||||||
| let navigator = Navigator() | ||||||||||||||||||||||||||||||||||||||||||||||
| navigator.append("Path1") | ||||||||||||||||||||||||||||||||||||||||||||||
| navigator.append("Path2") | ||||||||||||||||||||||||||||||||||||||||||||||
| navigator.alert( | ||||||||||||||||||||||||||||||||||||||||||||||
| title: "Alert", | ||||||||||||||||||||||||||||||||||||||||||||||
| message: { Text("Message") }, | ||||||||||||||||||||||||||||||||||||||||||||||
| actions: { EmptyView() } | ||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||
| navigator.sheet { Text("Sheet") } | ||||||||||||||||||||||||||||||||||||||||||||||
| navigator.confirmDialog( | ||||||||||||||||||||||||||||||||||||||||||||||
| title: "Dialog", | ||||||||||||||||||||||||||||||||||||||||||||||
| message: { Text("Message") }, | ||||||||||||||||||||||||||||||||||||||||||||||
| actions: { EmptyView() } | ||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||
| navigator.popToRoot() | ||||||||||||||||||||||||||||||||||||||||||||||
| #expect(navigator.path.isEmpty, "Path should be empty after popToRoot.") | ||||||||||||||||||||||||||||||||||||||||||||||
| #expect(navigator.alert == nil, "Alert should be nil after popToRoot.") | ||||||||||||||||||||||||||||||||||||||||||||||
| #expect(navigator.sheet == nil, "Sheet should be nil after popToRoot.") | ||||||||||||||||||||||||||||||||||||||||||||||
| #expect(navigator.confirmDialog == nil, "Confirm dialog should be nil after popToRoot.") | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| // MARK: - Model Identity Tests | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| @Test("NavigatorAlert Has Unique ID") | ||||||||||||||||||||||||||||||||||||||||||||||
| @MainActor | ||||||||||||||||||||||||||||||||||||||||||||||
| func testNavigatorAlertUniqueID() { | ||||||||||||||||||||||||||||||||||||||||||||||
| let alert1 = Navigator.NavigatorAlert( | ||||||||||||||||||||||||||||||||||||||||||||||
| title: "Alert", | ||||||||||||||||||||||||||||||||||||||||||||||
| message: { Text("Message") }, | ||||||||||||||||||||||||||||||||||||||||||||||
| actions: { EmptyView() } | ||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||
| let alert2 = Navigator.NavigatorAlert( | ||||||||||||||||||||||||||||||||||||||||||||||
| title: "Alert", | ||||||||||||||||||||||||||||||||||||||||||||||
| message: { Text("Message") }, | ||||||||||||||||||||||||||||||||||||||||||||||
| actions: { EmptyView() } | ||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||
| #expect(alert1.id != alert2.id, "Each NavigatorAlert should have a unique ID.") | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| @Test("NavigatorSheet Has Unique ID") | ||||||||||||||||||||||||||||||||||||||||||||||
| @MainActor | ||||||||||||||||||||||||||||||||||||||||||||||
| func testNavigatorSheetUniqueID() { | ||||||||||||||||||||||||||||||||||||||||||||||
| let sheet1 = Navigator.NavigatorSheet(content: { Text("Sheet") }) | ||||||||||||||||||||||||||||||||||||||||||||||
| let sheet2 = Navigator.NavigatorSheet(content: { Text("Sheet") }) | ||||||||||||||||||||||||||||||||||||||||||||||
| #expect(sheet1.id != sheet2.id, "Each NavigatorSheet should have a unique ID.") | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| @Test("NavigatorConfirmDialog Has Unique ID") | ||||||||||||||||||||||||||||||||||||||||||||||
| @MainActor | ||||||||||||||||||||||||||||||||||||||||||||||
| func testNavigatorConfirmDialogUniqueID() { | ||||||||||||||||||||||||||||||||||||||||||||||
| let dialog1 = Navigator.NavigatorConfirmDialog( | ||||||||||||||||||||||||||||||||||||||||||||||
| title: "Dialog", | ||||||||||||||||||||||||||||||||||||||||||||||
| message: { Text("Message") }, | ||||||||||||||||||||||||||||||||||||||||||||||
| actions: { EmptyView() } | ||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||
| let dialog2 = Navigator.NavigatorConfirmDialog( | ||||||||||||||||||||||||||||||||||||||||||||||
| title: "Dialog", | ||||||||||||||||||||||||||||||||||||||||||||||
| message: { Text("Message") }, | ||||||||||||||||||||||||||||||||||||||||||||||
| actions: { EmptyView() } | ||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||
| #expect(dialog1.id != dialog2.id, "Each NavigatorConfirmDialog should have a unique ID.") | ||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+291
to
+301
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To make this test's intent clearer, consider creating both
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| // MARK: - Sheet onDismiss Callback | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| @Test("NavigatorSheet Stores onDismiss Callback") | ||||||||||||||||||||||||||||||||||||||||||||||
| @MainActor | ||||||||||||||||||||||||||||||||||||||||||||||
| func testNavigatorSheetOnDismissCallback() { | ||||||||||||||||||||||||||||||||||||||||||||||
| var dismissed = false | ||||||||||||||||||||||||||||||||||||||||||||||
| let sheet = Navigator.NavigatorSheet( | ||||||||||||||||||||||||||||||||||||||||||||||
| content: { Text("Sheet") }, | ||||||||||||||||||||||||||||||||||||||||||||||
| onDismiss: { dismissed = true } | ||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||
| #expect(sheet.onDismiss != nil, "Sheet should store an onDismiss callback.") | ||||||||||||||||||||||||||||||||||||||||||||||
| sheet.onDismiss?() | ||||||||||||||||||||||||||||||||||||||||||||||
| #expect(dismissed, "onDismiss callback should execute when invoked.") | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| @Test("NavigatorSheet Without onDismiss") | ||||||||||||||||||||||||||||||||||||||||||||||
| @MainActor | ||||||||||||||||||||||||||||||||||||||||||||||
| func testNavigatorSheetWithoutOnDismiss() { | ||||||||||||||||||||||||||||||||||||||||||||||
| let sheet = Navigator.NavigatorSheet(content: { Text("Sheet") }) | ||||||||||||||||||||||||||||||||||||||||||||||
| #expect(sheet.onDismiss == nil, "Sheet should have nil onDismiss when none is provided.") | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| @Test("Sheet with onDismiss via Navigator") | ||||||||||||||||||||||||||||||||||||||||||||||
| @MainActor | ||||||||||||||||||||||||||||||||||||||||||||||
| func testSheetWithOnDismissViaNavigator() { | ||||||||||||||||||||||||||||||||||||||||||||||
| var callbackInvoked = false | ||||||||||||||||||||||||||||||||||||||||||||||
| let navigator = Navigator() | ||||||||||||||||||||||||||||||||||||||||||||||
| navigator.sheet(content: { Text("Sheet") }, onDismiss: { callbackInvoked = true }) | ||||||||||||||||||||||||||||||||||||||||||||||
| #expect(navigator.sheet != nil, "Navigator should present a sheet.") | ||||||||||||||||||||||||||||||||||||||||||||||
| navigator.sheet?.onDismiss?() | ||||||||||||||||||||||||||||||||||||||||||||||
| #expect(callbackInvoked, "onDismiss callback should be invocable from the stored sheet.") | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| // MARK: - Alert Replacement | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| @Test("Presenting New Alert Replaces Existing") | ||||||||||||||||||||||||||||||||||||||||||||||
| @MainActor | ||||||||||||||||||||||||||||||||||||||||||||||
| func testAlertReplacement() { | ||||||||||||||||||||||||||||||||||||||||||||||
| let navigator = Navigator() | ||||||||||||||||||||||||||||||||||||||||||||||
| navigator.alert(title: "First", message: { EmptyView() }, actions: { EmptyView() }) | ||||||||||||||||||||||||||||||||||||||||||||||
| let firstID = navigator.alert?.id | ||||||||||||||||||||||||||||||||||||||||||||||
| navigator.alert(title: "Second", message: { EmptyView() }, actions: { EmptyView() }) | ||||||||||||||||||||||||||||||||||||||||||||||
| #expect(navigator.alert?.title == "Second", "New alert should replace the existing one.") | ||||||||||||||||||||||||||||||||||||||||||||||
| #expect(navigator.alert?.id != firstID, "New alert should have a different ID.") | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To make this test's intent clearer, consider creating both
NavigatorAlertinstances with identical parameters. This emphasizes that new instances always get unique IDs, regardless of their content, which is the behavior being tested.