Skip to content

Commit a599ed2

Browse files
authored
Merge pull request #6947 from Shopify/rcb/config-model-snapshot-tests
Add config pipeline snapshot tests
2 parents 2fb48a9 + 2378a7f commit a599ed2

2 files changed

Lines changed: 685 additions & 0 deletions

File tree

Lines changed: 365 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,365 @@
1+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2+
3+
exports[`Config pipeline snapshots > config round-trip (write → read → write) reorders webhook subscriptions 1`] = `
4+
"# Learn more about configuring your app at https://shopify.dev/docs/apps/tools/cli/configuration
5+
6+
client_id = \\"12345\\"
7+
name = \\"My Test App\\"
8+
application_url = \\"https://myapp.example.com\\"
9+
embedded = true
10+
11+
[build]
12+
automatically_update_urls_on_dev = true
13+
dev_store_url = \\"test-store.myshopify.com\\"
14+
include_config_on_deploy = true
15+
16+
[access.admin]
17+
direct_api_mode = \\"online\\"
18+
embedded_app_direct_api_access = true
19+
20+
[access_scopes]
21+
# Learn more at https://shopify.dev/docs/apps/tools/cli/configuration#access_scopes
22+
scopes = \\"read_products,write_orders\\"
23+
required_scopes = [ \\"read_products\\" ]
24+
optional_scopes = [ \\"write_orders\\" ]
25+
use_legacy_install_flow = false
26+
27+
[auth]
28+
redirect_urls = [
29+
\\"https://myapp.example.com/auth/callback\\",
30+
\\"https://myapp.example.com/auth/shopify/callback\\"
31+
]
32+
33+
[webhooks]
34+
api_version = \\"2024-01\\"
35+
36+
[[webhooks.subscriptions]]
37+
uri = \\"/webhooks/compliance\\"
38+
compliance_topics = [ \\"customers/data_request\\", \\"customers/redact\\" ]
39+
40+
[[webhooks.subscriptions]]
41+
topics = [ \\"orders/create\\" ]
42+
uri = \\"/webhooks/orders\\"
43+
44+
[[webhooks.subscriptions]]
45+
topics = [ \\"products/create\\", \\"products/update\\" ]
46+
uri = \\"/webhooks/products\\"
47+
48+
[app_proxy]
49+
url = \\"https://myapp.example.com/proxy\\"
50+
subpath = \\"app\\"
51+
prefix = \\"apps\\"
52+
53+
[pos]
54+
embedded = false
55+
56+
[app_preferences]
57+
url = \\"https://myapp.example.com/preferences\\"
58+
"
59+
`;
60+
61+
exports[`Config pipeline snapshots > minimal config without webhooks produces stable output 1`] = `
62+
"# Learn more about configuring your app at https://shopify.dev/docs/apps/tools/cli/configuration
63+
64+
client_id = \\"12345\\"
65+
name = \\"Minimal App\\"
66+
application_url = \\"https://example.com\\"
67+
embedded = true
68+
69+
[access_scopes]
70+
# Learn more at https://shopify.dev/docs/apps/tools/cli/configuration#access_scopes
71+
scopes = \\"read_products\\"
72+
73+
[auth]
74+
redirect_urls = [ \\"https://example.com/auth/callback\\" ]
75+
"
76+
`;
77+
78+
exports[`Config pipeline snapshots > subscription with both topics and compliance_topics on same URI splits after round-trip 1`] = `
79+
"# Learn more about configuring your app at https://shopify.dev/docs/apps/tools/cli/configuration
80+
81+
client_id = \\"12345\\"
82+
name = \\"My Test App\\"
83+
application_url = \\"https://myapp.example.com\\"
84+
embedded = true
85+
86+
[build]
87+
automatically_update_urls_on_dev = true
88+
dev_store_url = \\"test-store.myshopify.com\\"
89+
include_config_on_deploy = true
90+
91+
[access.admin]
92+
direct_api_mode = \\"online\\"
93+
embedded_app_direct_api_access = true
94+
95+
[access_scopes]
96+
# Learn more at https://shopify.dev/docs/apps/tools/cli/configuration#access_scopes
97+
scopes = \\"read_products,write_orders\\"
98+
required_scopes = [ \\"read_products\\" ]
99+
optional_scopes = [ \\"write_orders\\" ]
100+
use_legacy_install_flow = false
101+
102+
[auth]
103+
redirect_urls = [
104+
\\"https://myapp.example.com/auth/callback\\",
105+
\\"https://myapp.example.com/auth/shopify/callback\\"
106+
]
107+
108+
[webhooks]
109+
api_version = \\"2024-01\\"
110+
111+
[[webhooks.subscriptions]]
112+
topics = [ \\"orders/create\\" ]
113+
uri = \\"/webhooks\\"
114+
compliance_topics = [ \\"customers/data_request\\", \\"customers/redact\\" ]
115+
116+
[app_proxy]
117+
url = \\"https://myapp.example.com/proxy\\"
118+
subpath = \\"app\\"
119+
prefix = \\"apps\\"
120+
121+
[pos]
122+
embedded = false
123+
124+
[app_preferences]
125+
url = \\"https://myapp.example.com/preferences\\"
126+
"
127+
`;
128+
129+
exports[`Config pipeline snapshots > subscriptions with same URI but different filters stay separate through round-trip 1`] = `
130+
"# Learn more about configuring your app at https://shopify.dev/docs/apps/tools/cli/configuration
131+
132+
client_id = \\"12345\\"
133+
name = \\"My Test App\\"
134+
application_url = \\"https://myapp.example.com\\"
135+
embedded = true
136+
137+
[build]
138+
automatically_update_urls_on_dev = true
139+
dev_store_url = \\"test-store.myshopify.com\\"
140+
include_config_on_deploy = true
141+
142+
[access.admin]
143+
direct_api_mode = \\"online\\"
144+
embedded_app_direct_api_access = true
145+
146+
[access_scopes]
147+
# Learn more at https://shopify.dev/docs/apps/tools/cli/configuration#access_scopes
148+
scopes = \\"read_products,write_orders\\"
149+
required_scopes = [ \\"read_products\\" ]
150+
optional_scopes = [ \\"write_orders\\" ]
151+
use_legacy_install_flow = false
152+
153+
[auth]
154+
redirect_urls = [
155+
\\"https://myapp.example.com/auth/callback\\",
156+
\\"https://myapp.example.com/auth/shopify/callback\\"
157+
]
158+
159+
[webhooks]
160+
api_version = \\"2024-01\\"
161+
162+
[[webhooks.subscriptions]]
163+
topics = [ \\"orders/create\\" ]
164+
uri = \\"/webhooks/orders\\"
165+
filter = \\"status:paid\\"
166+
167+
[[webhooks.subscriptions]]
168+
topics = [ \\"orders/update\\" ]
169+
uri = \\"/webhooks/orders\\"
170+
filter = \\"status:pending\\"
171+
172+
[app_proxy]
173+
url = \\"https://myapp.example.com/proxy\\"
174+
subpath = \\"app\\"
175+
prefix = \\"apps\\"
176+
177+
[pos]
178+
embedded = false
179+
180+
[app_preferences]
181+
url = \\"https://myapp.example.com/preferences\\"
182+
"
183+
`;
184+
185+
exports[`Config pipeline snapshots > subscriptions with same URI but different include_fields stay separate through round-trip 1`] = `
186+
"# Learn more about configuring your app at https://shopify.dev/docs/apps/tools/cli/configuration
187+
188+
client_id = \\"12345\\"
189+
name = \\"My Test App\\"
190+
application_url = \\"https://myapp.example.com\\"
191+
embedded = true
192+
193+
[build]
194+
automatically_update_urls_on_dev = true
195+
dev_store_url = \\"test-store.myshopify.com\\"
196+
include_config_on_deploy = true
197+
198+
[access.admin]
199+
direct_api_mode = \\"online\\"
200+
embedded_app_direct_api_access = true
201+
202+
[access_scopes]
203+
# Learn more at https://shopify.dev/docs/apps/tools/cli/configuration#access_scopes
204+
scopes = \\"read_products,write_orders\\"
205+
required_scopes = [ \\"read_products\\" ]
206+
optional_scopes = [ \\"write_orders\\" ]
207+
use_legacy_install_flow = false
208+
209+
[auth]
210+
redirect_urls = [
211+
\\"https://myapp.example.com/auth/callback\\",
212+
\\"https://myapp.example.com/auth/shopify/callback\\"
213+
]
214+
215+
[webhooks]
216+
api_version = \\"2024-01\\"
217+
218+
[[webhooks.subscriptions]]
219+
topics = [ \\"products/create\\" ]
220+
uri = \\"/webhooks/products\\"
221+
include_fields = [ \\"id\\", \\"title\\" ]
222+
223+
[[webhooks.subscriptions]]
224+
topics = [ \\"products/update\\" ]
225+
uri = \\"/webhooks/products\\"
226+
include_fields = [ \\"id\\" ]
227+
228+
[app_proxy]
229+
url = \\"https://myapp.example.com/proxy\\"
230+
subpath = \\"app\\"
231+
prefix = \\"apps\\"
232+
233+
[pos]
234+
embedded = false
235+
236+
[app_preferences]
237+
url = \\"https://myapp.example.com/preferences\\"
238+
"
239+
`;
240+
241+
exports[`Config pipeline snapshots > webhook subscriptions with mixed topics and compliance topics produce stable output 1`] = `
242+
"# Learn more about configuring your app at https://shopify.dev/docs/apps/tools/cli/configuration
243+
244+
client_id = \\"12345\\"
245+
name = \\"My Test App\\"
246+
application_url = \\"https://myapp.example.com\\"
247+
embedded = true
248+
249+
[build]
250+
automatically_update_urls_on_dev = true
251+
dev_store_url = \\"test-store.myshopify.com\\"
252+
include_config_on_deploy = true
253+
254+
[access.admin]
255+
direct_api_mode = \\"online\\"
256+
embedded_app_direct_api_access = true
257+
258+
[access_scopes]
259+
# Learn more at https://shopify.dev/docs/apps/tools/cli/configuration#access_scopes
260+
scopes = \\"read_products,write_orders\\"
261+
required_scopes = [ \\"read_products\\" ]
262+
optional_scopes = [ \\"write_orders\\" ]
263+
use_legacy_install_flow = false
264+
265+
[auth]
266+
redirect_urls = [
267+
\\"https://myapp.example.com/auth/callback\\",
268+
\\"https://myapp.example.com/auth/shopify/callback\\"
269+
]
270+
271+
[webhooks]
272+
api_version = \\"2024-01\\"
273+
274+
[[webhooks.subscriptions]]
275+
topics = [ \\"orders/create\\", \\"orders/updated\\", \\"orders/cancelled\\" ]
276+
uri = \\"/webhooks/orders\\"
277+
278+
[[webhooks.subscriptions]]
279+
topics = [ \\"products/create\\" ]
280+
uri = \\"/webhooks/products\\"
281+
include_fields = [ \\"id\\", \\"title\\" ]
282+
283+
[[webhooks.subscriptions]]
284+
uri = \\"/webhooks/compliance\\"
285+
compliance_topics = [ \\"customers/data_request\\", \\"customers/redact\\", \\"shop/redact\\" ]
286+
287+
[[webhooks.subscriptions]]
288+
topics = [ \\"app/uninstalled\\" ]
289+
uri = \\"/webhooks/app\\"
290+
291+
[app_proxy]
292+
url = \\"https://myapp.example.com/proxy\\"
293+
subpath = \\"app\\"
294+
prefix = \\"apps\\"
295+
296+
[pos]
297+
embedded = false
298+
299+
[app_preferences]
300+
url = \\"https://myapp.example.com/preferences\\"
301+
"
302+
`;
303+
304+
exports[`Config pipeline snapshots > webhook subscriptions with mixed topics and compliance topics produce stable output 2`] = `
305+
"# Learn more about configuring your app at https://shopify.dev/docs/apps/tools/cli/configuration
306+
307+
client_id = \\"12345\\"
308+
name = \\"My Test App\\"
309+
application_url = \\"https://myapp.example.com\\"
310+
embedded = true
311+
312+
[build]
313+
automatically_update_urls_on_dev = true
314+
dev_store_url = \\"test-store.myshopify.com\\"
315+
include_config_on_deploy = true
316+
317+
[access.admin]
318+
direct_api_mode = \\"online\\"
319+
embedded_app_direct_api_access = true
320+
321+
[access_scopes]
322+
# Learn more at https://shopify.dev/docs/apps/tools/cli/configuration#access_scopes
323+
scopes = \\"read_products,write_orders\\"
324+
required_scopes = [ \\"read_products\\" ]
325+
optional_scopes = [ \\"write_orders\\" ]
326+
use_legacy_install_flow = false
327+
328+
[auth]
329+
redirect_urls = [
330+
\\"https://myapp.example.com/auth/callback\\",
331+
\\"https://myapp.example.com/auth/shopify/callback\\"
332+
]
333+
334+
[webhooks]
335+
api_version = \\"2024-01\\"
336+
337+
[[webhooks.subscriptions]]
338+
uri = \\"/webhooks/compliance\\"
339+
compliance_topics = [ \\"customers/data_request\\", \\"customers/redact\\", \\"shop/redact\\" ]
340+
341+
[[webhooks.subscriptions]]
342+
topics = [ \\"app/uninstalled\\" ]
343+
uri = \\"/webhooks/app\\"
344+
345+
[[webhooks.subscriptions]]
346+
topics = [ \\"orders/cancelled\\", \\"orders/create\\", \\"orders/updated\\" ]
347+
uri = \\"/webhooks/orders\\"
348+
349+
[[webhooks.subscriptions]]
350+
topics = [ \\"products/create\\" ]
351+
uri = \\"/webhooks/products\\"
352+
include_fields = [ \\"id\\", \\"title\\" ]
353+
354+
[app_proxy]
355+
url = \\"https://myapp.example.com/proxy\\"
356+
subpath = \\"app\\"
357+
prefix = \\"apps\\"
358+
359+
[pos]
360+
embedded = false
361+
362+
[app_preferences]
363+
url = \\"https://myapp.example.com/preferences\\"
364+
"
365+
`;

0 commit comments

Comments
 (0)