Skip to content

Commit f688a2b

Browse files
committed
fix up code and remove test
1 parent cf9a602 commit f688a2b

File tree

3 files changed

+5
-18
lines changed

3 files changed

+5
-18
lines changed

.changeset/short-items-see.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
'@shopify/theme': patch
33
---
44

5-
Return error when running theme profile using a themekit access password
5+
Return error when running `theme profile` using a Theme Access password

packages/theme/src/cli/services/profile.test.ts

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -82,17 +82,6 @@ describe('profile', () => {
8282
expect(htmlContent).toContain('speedscope')
8383
})
8484

85-
test('uses provided passwords for authentication', async () => {
86-
// When
87-
await profile(mockAdminSession, themeId, urlPath, true, 'themeAccessPassword', 'storePassword')
88-
89-
// Then
90-
expect(ensureAuthenticatedStorefront).toHaveBeenCalledWith([], 'themeAccessPassword', {
91-
forceRefresh: false,
92-
noPrompt: true,
93-
})
94-
})
95-
9685
test('throws error when fetch fails', async () => {
9786
// Given
9887
vi.mocked(render).mockRejectedValue(new Error('Network error'))
@@ -120,15 +109,15 @@ describe('profile', () => {
120109
await expect(result).rejects.toThrow('Bad response: 404: {"error":"Some error message"}')
121110
})
122111

123-
test('throws error when an Admin API token is used', async () => {
112+
test('throws error when a password is used', async () => {
124113
// When
125114
const result = profile(mockAdminSession, themeId, urlPath, true, 'shpat_hello', undefined)
126115

127116
// Then
128117
await expect(result).rejects.toThrow(
129118
new AbortError(
130119
'Unable to use Admin API or Theme Access tokens with the profile command',
131-
'You can authenticate normally by not passing the --password flag.',
120+
'You must authenticate manually by not passing the --password flag.',
132121
),
133122
)
134123
})

packages/theme/src/cli/services/profile.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,10 @@ export async function profile(
2222
? await ensureValidPassword(storefrontPassword, adminSession.storeFqdn)
2323
: undefined
2424

25-
const isUnsupportedToken = ['shpat_', 'shptka_'].some((prefix) => themeAccessPassword?.startsWith(prefix))
26-
27-
if (isUnsupportedToken) {
25+
if (themeAccessPassword) {
2826
throw new AbortError(
2927
'Unable to use Admin API or Theme Access tokens with the profile command',
30-
'You can authenticate normally by not passing the --password flag.',
28+
'You must authenticate manually by not passing the --password flag.',
3129
)
3230
}
3331

0 commit comments

Comments
 (0)