Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions packages/theme/src/cli/utilities/theme-command.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ describe('ThemeCommand', () => {
})
})

test('uses a matching store auth cache session when stored scopes are empty', async () => {
test('falls back to theme authentication when the stored session has no recorded scopes', async () => {
vi.mocked(getCurrentStoredStoreAppSession).mockReturnValue({
store: 'test-store.myshopify.com',
clientId: 'store-auth-client-id',
Expand All @@ -371,10 +371,8 @@ describe('ThemeCommand', () => {

await command.run()

expect(ensureAuthenticatedThemes).not.toHaveBeenCalled()
expect(command.commandCalls[0]).toMatchObject({
session: {token: 'shpat_preview_token', storeFqdn: 'test-store.myshopify.com'},
})
expect(ensureAuthenticatedThemes).toHaveBeenCalledWith('test-store.myshopify.com', undefined)
expect(command.commandCalls[0]).toMatchObject({session: mockSession})
})

test('falls back to theme authentication when matching store auth session lacks required scopes', async () => {
Expand Down
2 changes: 0 additions & 2 deletions packages/theme/src/cli/utilities/theme-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -447,8 +447,6 @@ export default abstract class ThemeCommand extends Command {
}

private hasRequiredStoreAuthScopes(sessionScopes: string[], requiredScopes: string[]): boolean {
if (sessionScopes.length === 0) return true
Comment thread
alfonso-noriega marked this conversation as resolved.

const expandedScopes = this.expandImpliedStoreAuthScopes(sessionScopes)
return requiredScopes.every((scope) => expandedScopes.has(scope))
}
Expand Down
Loading