Skip to content

Commit 5569d4f

Browse files
committed
test: use AgentActionRegistry.shared singleton in tests
Refactor AgentActionRegistryTests to use AgentActionRegistry.shared instead of manually instantiating the class with a NotificationCenter. This aligns the test suite with the updated singleton pattern and simplifies the test setup.
1 parent 6f13cf8 commit 5569d4f

2 files changed

Lines changed: 12 additions & 13 deletions

File tree

.gitignore

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -730,14 +730,13 @@ Axon/Config/PublicConfig.local.plist
730730
!Axon/ViewModels/SettingsViewModels/APIKeysSettingsViewModel.swift
731731

732732
Axon/Resources/BundleResources/Testing/Out of Flux - finallyfree.mp3
733-
.gitignore
734-
.gitignore
735733
Axon/Resources/BundleResources/Testing/TestImage.png
736734
Axon/Resources/BundleResources/Testing/TestVideo.mp4
737735
Axon/Resources/BundleResources/Testing/Speech-to-Text-n-Audio-Understanding-Test-Audio.mp3
738-
Axon/Resources/gemma-4-E2B-it-MLX/model.safetensors
739-
Axon/Resources/gemma-4-E2B-it-MLX/tokenizer_config.json
740-
Axon/Resources/gemma-4-E2B-it-MLX/tokenizer.json
741-
Axon/Resources/gemma-4-E2B-it-MLX/config.json
742-
Axon/Resources/gemma-4-E2B-it-MLX/generation_config.json
743-
Axon/Resources/gemma-4-E2B-it-MLX/README.md
736+
Axon/Resources/MLXModels/google_gemma-4-E2B-it-MLX/model.safetensors
737+
Axon/Resources/MLXModels/google_gemma-4-E2B-it-MLX/tokenizer_config.json
738+
Axon/Resources/MLXModels/google_gemma-4-E2B-it-MLX/tokenizer.json
739+
Axon/Resources/MLXModels/google_gemma-4-E2B-it-MLX/config.json
740+
Axon/Resources/MLXModels/google_gemma-4-E2B-it-MLX/generation_config.json
741+
Axon/Resources/MLXModels/google_gemma-4-E2B-it-MLX/special_tokens_map.json
742+
Axon/Resources/MLXModels/google_gemma-4-E2B-it-MLX/README.md

AxonTests/AgentActionRegistryTests.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import XCTest
55
final class AgentActionRegistryTests: XCTestCase {
66

77
func testDiscoverActionsIncludesCoreSet() {
8-
let registry = AgentActionRegistry(notificationCenter: NotificationCenter())
8+
let registry = AgentActionRegistry.shared
99
let actions = registry.discoverActions()
1010
let ids = Set(actions.map(\.id))
1111

@@ -16,21 +16,21 @@ final class AgentActionRegistryTests: XCTestCase {
1616
}
1717

1818
func testDiscoverActionsFiltersByView() {
19-
let registry = AgentActionRegistry(notificationCenter: NotificationCenter())
19+
let registry = AgentActionRegistry.shared
2020
let actions = registry.discoverActions(view: "settings")
2121

2222
XCTAssertFalse(actions.isEmpty)
2323
XCTAssertTrue(actions.contains(where: { $0.id == "open_settings" }))
2424
}
2525

2626
func testDiscoverActionsUnknownPlatformReturnsEmpty() {
27-
let registry = AgentActionRegistry(notificationCenter: NotificationCenter())
27+
let registry = AgentActionRegistry.shared
2828
let actions = registry.discoverActions(platform: "linux")
2929
XCTAssertTrue(actions.isEmpty)
3030
}
3131

3232
func testRiskMetadataMarksSensitiveActions() {
33-
let registry = AgentActionRegistry(notificationCenter: NotificationCenter())
33+
let registry = AgentActionRegistry.shared
3434
let actions = registry.discoverActions()
3535

3636
guard let send = actions.first(where: { $0.id == "send_message" }) else {
@@ -47,7 +47,7 @@ final class AgentActionRegistryTests: XCTestCase {
4747
}
4848

4949
func testInvokeUnknownActionFailsDeterministically() async {
50-
let registry = AgentActionRegistry(notificationCenter: NotificationCenter())
50+
let registry = AgentActionRegistry.shared
5151
let result = await registry.invokeAction(id: "not_real_action")
5252

5353
XCTAssertFalse(result.success)

0 commit comments

Comments
 (0)