@@ -114,260 +114,6 @@ describe('updateAppIdentifiers', () => {
114114 }
115115 } )
116116 } )
117-
118- test ( 'adds the missing uid to a simple TOML for atomic deployments' , async ( ) => {
119- await inTemporaryDirectory ( async ( tmpDir : string ) => {
120- // Given
121- const uiExtension = await testUIExtension ( { directory : tmpDir } )
122- const app = testApp ( {
123- directory : tmpDir ,
124- allExtensions : [ uiExtension ] ,
125- } )
126- await writeFile (
127- uiExtension . configurationPath ,
128- `name = "tae"
129- type = "theme"` ,
130- )
131-
132- // When
133- await updateAppIdentifiers (
134- {
135- app,
136- identifiers : {
137- app : 'FOO' ,
138- extensions : {
139- my_extension : 'BAR' ,
140- } ,
141- } ,
142- command : 'deploy' ,
143- developerPlatformClient : testDeveloperPlatformClient ( { supportsAtomicDeployments : true } ) ,
144- } ,
145- { SHOPIFY_API_KEY : 'FOO' , SHOPIFY_MY_EXTENSION_ID : 'BAR' } ,
146- )
147-
148- // Then
149- const fileContent = await readFile ( uiExtension . configurationPath )
150- expect ( fileContent ) . toEqual ( `name = "tae"
151- uid = "${ uiExtension . uid } "
152- type = "theme"` )
153- } )
154- } )
155- } )
156-
157- test ( 'does not change a simple TOML when the uid is already present for atomic deployments' , async ( ) => {
158- await inTemporaryDirectory ( async ( tmpDir : string ) => {
159- // Given
160- const uiExtension = await testUIExtension ( { directory : tmpDir } )
161- const app = testApp ( {
162- directory : tmpDir ,
163- allExtensions : [ uiExtension ] ,
164- } )
165- await writeFile (
166- uiExtension . configurationPath ,
167- `name = "tae"
168- uid = "${ uiExtension . uid } "
169- type = "theme"` ,
170- )
171-
172- // When
173- await updateAppIdentifiers (
174- {
175- app,
176- identifiers : {
177- app : 'FOO' ,
178- extensions : {
179- my_extension : 'BAR' ,
180- } ,
181- } ,
182- command : 'deploy' ,
183- developerPlatformClient : testDeveloperPlatformClient ( { supportsAtomicDeployments : true } ) ,
184- } ,
185- { SHOPIFY_API_KEY : 'FOO' , SHOPIFY_MY_EXTENSION_ID : 'BAR' } ,
186- )
187-
188- // Then
189- const fileContent = await readFile ( uiExtension . configurationPath )
190- expect ( fileContent ) . toEqual ( `name = "tae"
191- uid = "${ uiExtension . uid } "
192- type = "theme"` )
193- } )
194- } )
195-
196- test ( 'adds the missing uid to a unified config TOML for atomic deployments' , async ( ) => {
197- await inTemporaryDirectory ( async ( tmpDir : string ) => {
198- // Given
199- const uiExtension = await testUIExtension ( {
200- directory : tmpDir ,
201- configuration : {
202- name : 'Extension 1' ,
203- handle : 'ext1' ,
204- type : 'ui_extension' ,
205- metafields : [ ] ,
206- } ,
207- } )
208- const app = testApp ( {
209- directory : tmpDir ,
210- allExtensions : [ uiExtension ] ,
211- } )
212- await writeFile (
213- uiExtension . configurationPath ,
214- `api_version = "2024-04"
215- [[extensions]]
216- name = "Extension 1"
217- handle = "ext1"
218- type = "ui_extension"` ,
219- )
220-
221- // When
222- await updateAppIdentifiers (
223- {
224- app,
225- identifiers : {
226- app : 'FOO' ,
227- extensions : {
228- my_extension : 'BAR' ,
229- } ,
230- } ,
231- command : 'deploy' ,
232- developerPlatformClient : testDeveloperPlatformClient ( { supportsAtomicDeployments : true } ) ,
233- } ,
234- { SHOPIFY_API_KEY : 'FOO' , SHOPIFY_MY_EXTENSION_ID : 'BAR' } ,
235- )
236-
237- // Then
238- const fileContent = await readFile ( uiExtension . configurationPath )
239- expect ( fileContent ) . toEqual ( `api_version = "2024-04"
240- [[extensions]]
241- name = "Extension 1"
242- handle = "ext1"
243- uid = "${ uiExtension . uid } "
244- type = "ui_extension"` )
245- } )
246- } )
247-
248- test ( 'does not change a unified config TOML when the uid is already present for atomic deployments' , async ( ) => {
249- await inTemporaryDirectory ( async ( tmpDir : string ) => {
250- // Given
251- const uiExtension = await testUIExtension ( {
252- directory : tmpDir ,
253- configuration : {
254- name : 'Extension 1' ,
255- handle : 'ext1' ,
256- type : 'ui_extension' ,
257- metafields : [ ] ,
258- } ,
259- } )
260- const app = testApp ( {
261- directory : tmpDir ,
262- allExtensions : [ uiExtension ] ,
263- } )
264- await writeFile (
265- uiExtension . configurationPath ,
266- `api_version = "2024-04"
267- [[extensions]]
268- name = "Extension 1"
269- handle = "ext1"
270- uid = "${ uiExtension . uid } "
271- type = "ui_extension"` ,
272- )
273-
274- // When
275- await updateAppIdentifiers (
276- {
277- app,
278- identifiers : {
279- app : 'FOO' ,
280- extensions : {
281- my_extension : 'BAR' ,
282- } ,
283- } ,
284- command : 'deploy' ,
285- developerPlatformClient : testDeveloperPlatformClient ( { supportsAtomicDeployments : true } ) ,
286- } ,
287- { SHOPIFY_API_KEY : 'FOO' , SHOPIFY_MY_EXTENSION_ID : 'BAR' } ,
288- )
289-
290- // Then
291- const fileContent = await readFile ( uiExtension . configurationPath )
292- expect ( fileContent ) . toEqual ( `api_version = "2024-04"
293- [[extensions]]
294- name = "Extension 1"
295- handle = "ext1"
296- uid = "${ uiExtension . uid } "
297- type = "ui_extension"` )
298- } )
299- } )
300-
301- test ( 'adds the missing uids to a unified config TOML with multiple extensions for atomic deployments' , async ( ) => {
302- await inTemporaryDirectory ( async ( tmpDir : string ) => {
303- // Given
304- const uiExtension1 = await testUIExtension ( {
305- directory : tmpDir ,
306- configuration : {
307- name : 'Extension 1' ,
308- handle : 'ext1' ,
309- type : 'ui_extension' ,
310- metafields : [ ] ,
311- } ,
312- } )
313- const uiExtension2 = await testUIExtension ( {
314- directory : tmpDir ,
315- configuration : {
316- name : 'Extension 2' ,
317- handle : 'ext2' ,
318- type : 'ui_extension' ,
319- metafields : [ ] ,
320- } ,
321- } )
322- const app = testApp ( {
323- directory : tmpDir ,
324- allExtensions : [ uiExtension1 , uiExtension2 ] ,
325- } )
326- await writeFile (
327- uiExtension1 . configurationPath ,
328- `api_version = "2024-04"
329- [[extensions]]
330- name = "t:name"
331- handle = "ext2"
332- type = "ui_extension"
333-
334- [[extensions]]
335- name = "t:name"
336- handle = "ext1"
337- type = "ui_extension"` ,
338- )
339-
340- // When
341- await updateAppIdentifiers (
342- {
343- app,
344- identifiers : {
345- app : 'FOO' ,
346- extensions : {
347- my_extension : 'BAR' ,
348- } ,
349- } ,
350- command : 'deploy' ,
351- developerPlatformClient : testDeveloperPlatformClient ( { supportsAtomicDeployments : true } ) ,
352- } ,
353- { SHOPIFY_API_KEY : 'FOO' , SHOPIFY_MY_EXTENSION_ID : 'BAR' } ,
354- )
355-
356- // Then
357- const fileContent = await readFile ( uiExtension1 . configurationPath )
358- expect ( fileContent ) . toEqual ( `api_version = "2024-04"
359- [[extensions]]
360- name = "t:name"
361- handle = "ext2"
362- uid = "${ uiExtension2 . uid } "
363- type = "ui_extension"
364-
365- [[extensions]]
366- name = "t:name"
367- handle = "ext1"
368- uid = "${ uiExtension1 . uid } "
369- type = "ui_extension"` )
370- } )
371117} )
372118
373119test ( 'does not change a unified config TOML with multiple when the uid is already present for atomic deployments' , async ( ) => {
0 commit comments