@@ -4,10 +4,10 @@ import {describe, vi, expect, test, beforeEach} from 'vitest'
44import { Config , Flags } from '@oclif/core'
55import { AdminSession , ensureAuthenticatedThemes } from '@shopify/cli-kit/node/session'
66import { loadEnvironment } from '@shopify/cli-kit/node/environments'
7- import { renderConcurrent , renderConfirmationPrompt , renderError } from '@shopify/cli-kit/node/ui'
87import { fileExistsSync } from '@shopify/cli-kit/node/fs'
98import { AbortError } from '@shopify/cli-kit/node/error'
109import { resolvePath } from '@shopify/cli-kit/node/path'
10+ import { renderConcurrent , renderConfirmationPrompt , renderError , renderWarning } from '@shopify/cli-kit/node/ui'
1111import type { Writable } from 'stream'
1212
1313vi . mock ( '@shopify/cli-kit/node/session' )
@@ -120,6 +120,10 @@ class TestUnauthenticatedThemeCommand extends ThemeCommand {
120120 }
121121}
122122
123+ class TestNoMultiEnvThemeCommand extends TestThemeCommand {
124+ static multiEnvironmentsFlags : RequiredFlags = null
125+ }
126+
123127describe ( 'ThemeCommand' , ( ) => {
124128 let mockSession : AdminSession
125129
@@ -227,6 +231,31 @@ describe('ThemeCommand', () => {
227231 await expect ( command . run ( ) ) . rejects . toThrow ( AbortError )
228232 expect ( fileExistsSync ) . toHaveBeenCalledWith ( 'current/working/directory' )
229233 } )
234+
235+ test ( 'multiple environments provided - displays warning if not allowed' , async ( ) => {
236+ // Given
237+ const environmentConfig = { store : 'store.myshopify.com' }
238+ vi . mocked ( loadEnvironment ) . mockResolvedValue ( environmentConfig )
239+ vi . mocked ( ensureAuthenticatedThemes ) . mockResolvedValue ( mockSession )
240+
241+ vi . mocked ( renderConcurrent ) . mockResolvedValue ( undefined )
242+
243+ await CommandConfig . load ( )
244+ const command = new TestNoMultiEnvThemeCommand (
245+ [ '--environment' , 'development' , '--environment' , 'staging' ] ,
246+ CommandConfig ,
247+ )
248+
249+ // When
250+ await command . run ( )
251+
252+ // Then
253+ expect ( renderWarning ) . toHaveBeenCalledWith (
254+ expect . objectContaining ( {
255+ body : 'This command does not support multiple environments.' ,
256+ } ) ,
257+ )
258+ } )
230259 } )
231260
232261 describe ( 'multi environment' , ( ) => {
0 commit comments