Skip to content

Commit 329e524

Browse files
isaacroldanClaude Code
andcommitted
Add regression test for external spec identifier matching
Co-authored-by: Claude Code <claude-code@anthropic.com>
1 parent 6ef9188 commit 329e524

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

packages/app/src/cli/services/context/breakdown-extensions.test.ts

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,21 @@ const MODULE_CLI_A_NO_UID: AppModuleVersion = {
9090
},
9191
}
9292

93+
const MODULE_CLI_A_EXTERNAL_IDENTIFIER: AppModuleVersion = {
94+
registrationId: 'A',
95+
registrationUuid: 'UUID_A',
96+
registrationTitle: 'Checkout post purchase',
97+
type: 'checkout_post_purchase_external',
98+
specification: {
99+
identifier: 'checkout_post_purchase_external',
100+
name: 'Post purchase UI extension',
101+
experience: 'extension',
102+
options: {
103+
managementExperience: 'cli',
104+
},
105+
},
106+
}
107+
93108
const MODULE_DASHBOARD_MIGRATED_CLI_A: AppModuleVersion = {
94109
registrationId: 'A',
95110
registrationUuid: 'UUID_A',
@@ -567,6 +582,52 @@ describe('extensionsIdentifiersDeployBreakdown', () => {
567582
remoteExtensionsRegistrations: remoteExtensionRegistrations.app,
568583
})
569584
})
585+
586+
test('and there is an active version with a module matching a local spec external identifier then cli extension should be unchanged', async () => {
587+
// Given
588+
const extensionsToConfirm = {
589+
validMatches: {EXTENSION_A: 'UUID_A'},
590+
dashboardOnlyExtensions: [REGISTRATION_DASHBOARD_A],
591+
extensionsToCreate: [EXTENSION_A_2],
592+
didMigrateDashboardExtensions: false,
593+
}
594+
vi.mocked(ensureExtensionsIds).mockResolvedValue(extensionsToConfirm)
595+
const remoteExtensionRegistrations = {
596+
app: {
597+
extensionRegistrations: [REGISTRATION_A],
598+
configurationRegistrations: [],
599+
dashboardManagedExtensionRegistrations: [REGISTRATION_DASHBOARD_A],
600+
},
601+
}
602+
const activeAppVersion = {
603+
appModuleVersions: [MODULE_CONFIG_A, MODULE_DASHBOARD_A, MODULE_CLI_A_EXTERNAL_IDENTIFIER],
604+
}
605+
606+
const developerPlatformClient: DeveloperPlatformClient = testDeveloperPlatformClient({
607+
appExtensionRegistrations: (_app: MinimalAppIdentifiers) => Promise.resolve(remoteExtensionRegistrations),
608+
})
609+
610+
// When
611+
const result = await extensionsIdentifiersDeployBreakdown(
612+
await options({uiExtensions, developerPlatformClient, activeAppVersion}),
613+
)
614+
615+
// Then
616+
expect(result).toEqual({
617+
extensionIdentifiersBreakdown: {
618+
onlyRemote: [],
619+
toCreate: [buildExtensionBreakdownInfo('extension-a-2', 'test-ui-extension-uid')],
620+
toUpdate: [],
621+
unchanged: [
622+
buildExtensionBreakdownInfo('EXTENSION_A', undefined),
623+
buildDashboardBreakdownInfo('Dashboard A'),
624+
],
625+
},
626+
extensionsToConfirm,
627+
remoteExtensionsRegistrations: remoteExtensionRegistrations.app,
628+
})
629+
})
630+
570631
test('and there is an active version with matching dashboard migrated cli app modules then migrated extension should be returned in the to create', async () => {
571632
// Given
572633
const remoteExtensionRegistrations = {

0 commit comments

Comments
 (0)