Post

Replies

Boosts

Views

Activity

Reply to Writing unit tests for AppIntent with a @AppDependency declared
Just figured this out. Here's how to create an instance of your app intent with a custom dependency manager: let dependencyManager = AppDependencyManager() dependencyManager.add(dependency: 5) let appIntent = TestAppIntent(count: .init(manager: dependencyManager)) let _ = try await appIntent.resolveAndPerform() Your way with an extension should work too, but is unnecessary if your code can access the intent type's default .init() method. You have to use .resolveAndPerform() to get the dependency injection to happen, .perform() alone doesn't do it.
Jun ’25