Skip to content
Draft
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
20 changes: 20 additions & 0 deletions packages/theme/src/cli/commands/theme/metafields/pull.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,26 @@ test('reports cancellation without fetching or writing definitions', async () =>
})
})

test('reports the language server skip without fetching or writing definitions', async () => {
vi.stubEnv('SHOPIFY_LANGUAGE_SERVER', '1')
try {
await inTemporaryDirectory(async (directory) => {
await withCapturedStandardStreams(async ({stdout, stderr}) => {
await expect(run(directory)).resolves.toBe(0)
const result = JSON.parse(stdout())
expect(result).toEqual({status: 'skipped', reason: 'not-a-theme'})
expect(themeMetafieldsPullJsonOutputSchema.validate(result)).toEqual(result)
expect(stderr()).toBe('')
expect(ensureDirectoryConfirmed).not.toHaveBeenCalled()
expect(metafieldDefinitionsByOwnerType).not.toHaveBeenCalled()
})
await expect(fileExists(joinPath(directory, '.shopify/metafields.json'))).resolves.toBe(false)
})
} finally {
vi.unstubAllEnvs()
}
})

test('does not emit a result when writing the downloaded file fails', async () => {
vi.mocked(metafieldDefinitionsByOwnerType).mockResolvedValue([])
await inTemporaryDirectory(async (directory) => {
Expand Down