@@ -74,12 +74,14 @@ import {SchemaDefinitionByTargetQueryVariables} from '../../api/graphql/function
7474import { SchemaDefinitionByApiTypeQueryVariables } from '../../api/graphql/functions/generated/schema-definition-by-api-type.js'
7575import { AppHomeSpecIdentifier } from '../extensions/specifications/app_config_app_home.js'
7676import { AppProxySpecIdentifier } from '../extensions/specifications/app_config_app_proxy.js'
77- import { ExtensionSpecification , isAppConfigSpecification } from '../extensions/specification.js'
77+ import { ExtensionSpecification } from '../extensions/specification.js'
7878import { AppLogsOptions } from '../../services/app-logs/utils.js'
7979import { AppLogsSubscribeMutationVariables } from '../../api/graphql/app-management/generated/app-logs-subscribe.js'
80+ import { Project } from '../project/project.js'
8081import { Session } from '@shopify/cli-kit/node/session'
8182import { vi } from 'vitest'
8283import { joinPath } from '@shopify/cli-kit/node/path'
84+ import { PackageManager } from '@shopify/cli-kit/node/node-package-manager'
8385
8486export const DEFAULT_CONFIG = {
8587 application_url : 'https://myapp.com' ,
@@ -104,9 +106,7 @@ export function testApp(app: Partial<AppInterface> = {}): AppInterface {
104106 name : app . name ?? 'App' ,
105107 directory : app . directory ?? '/tmp/project' ,
106108 configPath : app . configPath ?? '/tmp/project/shopify.app.toml' ,
107- packageManager : app . packageManager ?? 'yarn' ,
108109 configuration : app . configuration ?? getConfig ( ) ,
109- nodeDependencies : app . nodeDependencies ?? { } ,
110110 webs : app . webs ?? [
111111 {
112112 directory : '' ,
@@ -117,7 +117,6 @@ export function testApp(app: Partial<AppInterface> = {}): AppInterface {
117117 } ,
118118 ] ,
119119 modules : app . allExtensions ?? [ ] ,
120- usesWorkspaces : app . usesWorkspaces ?? false ,
121120 dotenv : app . dotenv ,
122121 errors : app . errors ,
123122 specifications : app . specifications ?? [ ] ,
@@ -127,9 +126,6 @@ export function testApp(app: Partial<AppInterface> = {}): AppInterface {
127126 devApplicationURLs : app . devApplicationURLs ,
128127 } )
129128
130- if ( app . updateDependencies ) {
131- Object . getPrototypeOf ( newApp ) . updateDependencies = app . updateDependencies
132- }
133129 if ( app . extensionsForType ) {
134130 Object . getPrototypeOf ( newApp ) . extensionsForType = app . extensionsForType
135131 }
@@ -155,6 +151,34 @@ export function testAppWithConfig(options?: TestAppWithConfigOptions): AppLinked
155151 return app
156152}
157153
154+ interface TestProjectOptions {
155+ directory ?: string
156+ packageManager ?: PackageManager
157+ nodeDependencies ?: Record < string , string >
158+ usesWorkspaces ?: boolean
159+ }
160+
161+ /**
162+ * Creates a minimal Project mock for testing.
163+ * Use this when a service needs a Project for packageManager, usesWorkspaces, or directory.
164+ */
165+ export function testProject ( options : TestProjectOptions = { } ) : Project {
166+ return {
167+ directory : options . directory ?? '/tmp/project' ,
168+ packageManager : options . packageManager ?? 'yarn' ,
169+ nodeDependencies : options . nodeDependencies ?? { } ,
170+ usesWorkspaces : options . usesWorkspaces ?? false ,
171+ appConfigFiles : [ ] ,
172+ extensionConfigFiles : [ ] ,
173+ webConfigFiles : [ ] ,
174+ dotenvFiles : new Map ( ) ,
175+ hiddenConfigRaw : { } ,
176+ appConfigByName : ( ) => undefined ,
177+ appConfigByClientId : ( ) => undefined ,
178+ defaultAppConfig : undefined ,
179+ } as unknown as Project
180+ }
181+
158182export function getWebhookConfig ( webhookConfigOverrides ?: WebhooksConfig ) : CurrentAppConfiguration {
159183 return {
160184 ...DEFAULT_CONFIG ,
@@ -1526,5 +1550,5 @@ export async function buildVersionedAppSchema() {
15261550}
15271551
15281552export async function configurationSpecifications ( ) {
1529- return ( await loadLocalExtensionsSpecifications ( ) ) . filter ( isAppConfigSpecification )
1553+ return ( await loadLocalExtensionsSpecifications ( ) ) . filter ( ( spec ) => spec . uidStrategy === 'single' )
15301554}
0 commit comments