|
1 | | -import {themeInfoJSON, fetchThemeInfo} from './info.js' |
| 1 | +import {themeInfoJSON, fetchThemeInfo, devInfoJSON} from './info.js' |
| 2 | +import {getDevelopmentTheme, getThemeStore} from './local-storage.js' |
2 | 3 | import {findOrSelectTheme} from '../utilities/theme-selector.js' |
3 | 4 | import {DevelopmentThemeManager} from '../utilities/development-theme-manager.js' |
4 | 5 | import {themePreviewUrl, themeEditorUrl} from '@shopify/cli-kit/node/themes/urls' |
5 | 6 | import {Theme} from '@shopify/cli-kit/node/themes/types' |
6 | 7 | import {describe, vi, test, expect} from 'vitest' |
7 | 8 |
|
| 9 | +vi.mock('./local-storage.js') |
8 | 10 | vi.mock('../utilities/development-theme-manager.js') |
9 | 11 | vi.mock('../utilities/theme-selector.js', () => { |
10 | 12 | return {findOrSelectTheme: vi.fn()} |
@@ -47,6 +49,23 @@ describe('info', () => { |
47 | 49 | expect(output).toHaveProperty('theme.editor_url', expect.stringContaining(session.storeFqdn)) |
48 | 50 | }) |
49 | 51 |
|
| 52 | + test('generate dev info JSON when no theme or dev flag provided', () => { |
| 53 | + // Given |
| 54 | + vi.mocked(getThemeStore).mockReturnValue('my-shop.myshopify.com') |
| 55 | + vi.mocked(getDevelopmentTheme).mockReturnValue(undefined) |
| 56 | + |
| 57 | + // When |
| 58 | + const output = devInfoJSON({cliVersion: '3.91.0'}) |
| 59 | + |
| 60 | + // Then |
| 61 | + expect(output).toHaveProperty('store', 'my-shop.myshopify.com') |
| 62 | + expect(output).toHaveProperty('development_theme_id', null) |
| 63 | + expect(output).toHaveProperty('cli_version', '3.91.0') |
| 64 | + expect(output).toHaveProperty('os', expect.stringContaining('-')) |
| 65 | + expect(output).toHaveProperty('shell', process.env.SHELL ?? 'unknown') |
| 66 | + expect(output).toHaveProperty('node_version', process.version) |
| 67 | + }) |
| 68 | + |
50 | 69 | test('fetch theme info by id', async () => { |
51 | 70 | // Given |
52 | 71 | vi.mocked(findOrSelectTheme).mockResolvedValue(theme) |
|
0 commit comments