@platformos/platformos-common 0.0.10 → 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/CLAUDE.md +70 -0
- package/dist/path-utils.d.ts +59 -15
- package/dist/path-utils.js +100 -28
- package/dist/path-utils.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/path-utils.spec.ts +320 -33
- package/src/path-utils.ts +103 -28
package/src/path-utils.spec.ts
CHANGED
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
getAppPaths,
|
|
6
6
|
getModulePaths,
|
|
7
7
|
isKnownLiquidFile,
|
|
8
|
+
isKnownGraphQLFile,
|
|
8
9
|
isPartial,
|
|
9
10
|
isPage,
|
|
10
11
|
isLayout,
|
|
@@ -13,32 +14,28 @@ import {
|
|
|
13
14
|
isApiCall,
|
|
14
15
|
isSms,
|
|
15
16
|
isMigration,
|
|
17
|
+
isFormConfiguration,
|
|
16
18
|
} from './path-utils';
|
|
17
19
|
|
|
18
|
-
// Helper: build a realistic absolute URI
|
|
20
|
+
// Helper: build a realistic absolute URI under a project root
|
|
19
21
|
const uri = (path: string) => `file:///project/${path}`;
|
|
20
22
|
|
|
23
|
+
// ─── getFileType ──────────────────────────────────────────────────────────────
|
|
24
|
+
|
|
21
25
|
describe('getFileType', () => {
|
|
22
|
-
describe('app
|
|
23
|
-
it('identifies pages', () => {
|
|
26
|
+
describe('app/ root — Liquid types', () => {
|
|
27
|
+
it('identifies pages (views/pages and pages aliases)', () => {
|
|
24
28
|
expect(getFileType(uri('app/views/pages/home.liquid'))).toBe(PlatformOSFileType.Page);
|
|
25
|
-
expect(getFileType(uri('app/views/pages/nested/
|
|
26
|
-
|
|
27
|
-
);
|
|
29
|
+
expect(getFileType(uri('app/views/pages/nested/item.liquid'))).toBe(PlatformOSFileType.Page);
|
|
30
|
+
expect(getFileType(uri('app/pages/home.liquid'))).toBe(PlatformOSFileType.Page);
|
|
28
31
|
});
|
|
29
32
|
|
|
30
33
|
it('identifies layouts', () => {
|
|
31
34
|
expect(getFileType(uri('app/views/layouts/default.liquid'))).toBe(PlatformOSFileType.Layout);
|
|
32
35
|
});
|
|
33
36
|
|
|
34
|
-
it('identifies partials
|
|
37
|
+
it('identifies partials (views/partials and lib)', () => {
|
|
35
38
|
expect(getFileType(uri('app/views/partials/header.liquid'))).toBe(PlatformOSFileType.Partial);
|
|
36
|
-
expect(getFileType(uri('app/views/partials/nested/card.liquid'))).toBe(
|
|
37
|
-
PlatformOSFileType.Partial,
|
|
38
|
-
);
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
it('identifies partials in app/lib', () => {
|
|
42
39
|
expect(getFileType(uri('app/lib/helpers/format.liquid'))).toBe(PlatformOSFileType.Partial);
|
|
43
40
|
expect(getFileType(uri('app/lib/utils.liquid'))).toBe(PlatformOSFileType.Partial);
|
|
44
41
|
});
|
|
@@ -49,16 +46,25 @@ describe('getFileType', () => {
|
|
|
49
46
|
);
|
|
50
47
|
});
|
|
51
48
|
|
|
52
|
-
it('identifies emails', () => {
|
|
49
|
+
it('identifies emails (emails and notifications/email_notifications aliases)', () => {
|
|
53
50
|
expect(getFileType(uri('app/emails/welcome.liquid'))).toBe(PlatformOSFileType.Email);
|
|
51
|
+
expect(getFileType(uri('app/notifications/email_notifications/welcome.liquid'))).toBe(
|
|
52
|
+
PlatformOSFileType.Email,
|
|
53
|
+
);
|
|
54
54
|
});
|
|
55
55
|
|
|
56
|
-
it('identifies api_calls', () => {
|
|
56
|
+
it('identifies api_calls (api_calls and notifications/api_call_notifications aliases)', () => {
|
|
57
57
|
expect(getFileType(uri('app/api_calls/create_user.liquid'))).toBe(PlatformOSFileType.ApiCall);
|
|
58
|
+
expect(getFileType(uri('app/notifications/api_call_notifications/create_user.liquid'))).toBe(
|
|
59
|
+
PlatformOSFileType.ApiCall,
|
|
60
|
+
);
|
|
58
61
|
});
|
|
59
62
|
|
|
60
|
-
it('identifies smses', () => {
|
|
63
|
+
it('identifies smses (smses and notifications/sms_notifications aliases)', () => {
|
|
61
64
|
expect(getFileType(uri('app/smses/notification.liquid'))).toBe(PlatformOSFileType.Sms);
|
|
65
|
+
expect(getFileType(uri('app/notifications/sms_notifications/notification.liquid'))).toBe(
|
|
66
|
+
PlatformOSFileType.Sms,
|
|
67
|
+
);
|
|
62
68
|
});
|
|
63
69
|
|
|
64
70
|
it('identifies migrations', () => {
|
|
@@ -67,8 +73,54 @@ describe('getFileType', () => {
|
|
|
67
73
|
);
|
|
68
74
|
});
|
|
69
75
|
|
|
70
|
-
it('identifies
|
|
76
|
+
it('identifies form_configurations (form_configurations and forms aliases)', () => {
|
|
77
|
+
expect(getFileType(uri('app/form_configurations/create_user.liquid'))).toBe(
|
|
78
|
+
PlatformOSFileType.FormConfiguration,
|
|
79
|
+
);
|
|
80
|
+
expect(getFileType(uri('app/forms/create_user.liquid'))).toBe(
|
|
81
|
+
PlatformOSFileType.FormConfiguration,
|
|
82
|
+
);
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
describe('app/ root — YAML types', () => {
|
|
87
|
+
it('identifies custom_model_types (custom_model_types, model_schemas, schema aliases)', () => {
|
|
88
|
+
expect(getFileType(uri('app/custom_model_types/property.yml'))).toBe(
|
|
89
|
+
PlatformOSFileType.CustomModelType,
|
|
90
|
+
);
|
|
91
|
+
expect(getFileType(uri('app/model_schemas/property.yml'))).toBe(
|
|
92
|
+
PlatformOSFileType.CustomModelType,
|
|
93
|
+
);
|
|
94
|
+
expect(getFileType(uri('app/schema/property.yml'))).toBe(PlatformOSFileType.CustomModelType);
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
it('identifies instance_profile_types (instance_profile_types, user_profile_types, user_profile_schemas aliases)', () => {
|
|
98
|
+
expect(getFileType(uri('app/instance_profile_types/default.yml'))).toBe(
|
|
99
|
+
PlatformOSFileType.InstanceProfileType,
|
|
100
|
+
);
|
|
101
|
+
expect(getFileType(uri('app/user_profile_types/default.yml'))).toBe(
|
|
102
|
+
PlatformOSFileType.InstanceProfileType,
|
|
103
|
+
);
|
|
104
|
+
expect(getFileType(uri('app/user_profile_schemas/default.yml'))).toBe(
|
|
105
|
+
PlatformOSFileType.InstanceProfileType,
|
|
106
|
+
);
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
it('identifies transactable_types', () => {
|
|
110
|
+
expect(getFileType(uri('app/transactable_types/listing.yml'))).toBe(
|
|
111
|
+
PlatformOSFileType.TransactableType,
|
|
112
|
+
);
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
it('identifies translations', () => {
|
|
116
|
+
expect(getFileType(uri('app/translations/en.yml'))).toBe(PlatformOSFileType.Translation);
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
describe('app/ root — GraphQL and Asset', () => {
|
|
121
|
+
it('identifies graphql (graphql and graph_queries aliases)', () => {
|
|
71
122
|
expect(getFileType(uri('app/graphql/users.graphql'))).toBe(PlatformOSFileType.GraphQL);
|
|
123
|
+
expect(getFileType(uri('app/graph_queries/users.graphql'))).toBe(PlatformOSFileType.GraphQL);
|
|
72
124
|
});
|
|
73
125
|
|
|
74
126
|
it('identifies assets', () => {
|
|
@@ -77,6 +129,44 @@ describe('getFileType', () => {
|
|
|
77
129
|
});
|
|
78
130
|
});
|
|
79
131
|
|
|
132
|
+
describe('marketplace_builder/ legacy root', () => {
|
|
133
|
+
it('identifies pages under marketplace_builder', () => {
|
|
134
|
+
expect(getFileType(uri('marketplace_builder/views/pages/home.liquid'))).toBe(
|
|
135
|
+
PlatformOSFileType.Page,
|
|
136
|
+
);
|
|
137
|
+
expect(getFileType(uri('marketplace_builder/pages/home.liquid'))).toBe(
|
|
138
|
+
PlatformOSFileType.Page,
|
|
139
|
+
);
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
it('identifies layouts under marketplace_builder', () => {
|
|
143
|
+
expect(getFileType(uri('marketplace_builder/views/layouts/default.liquid'))).toBe(
|
|
144
|
+
PlatformOSFileType.Layout,
|
|
145
|
+
);
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
it('identifies partials under marketplace_builder', () => {
|
|
149
|
+
expect(getFileType(uri('marketplace_builder/views/partials/header.liquid'))).toBe(
|
|
150
|
+
PlatformOSFileType.Partial,
|
|
151
|
+
);
|
|
152
|
+
expect(getFileType(uri('marketplace_builder/lib/utils.liquid'))).toBe(
|
|
153
|
+
PlatformOSFileType.Partial,
|
|
154
|
+
);
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
it('identifies graphql under marketplace_builder', () => {
|
|
158
|
+
expect(getFileType(uri('marketplace_builder/graphql/query.graphql'))).toBe(
|
|
159
|
+
PlatformOSFileType.GraphQL,
|
|
160
|
+
);
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
it('identifies form_configurations under marketplace_builder', () => {
|
|
164
|
+
expect(getFileType(uri('marketplace_builder/form_configurations/create.liquid'))).toBe(
|
|
165
|
+
PlatformOSFileType.FormConfiguration,
|
|
166
|
+
);
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
|
|
80
170
|
describe('module paths (modules/{name}/public|private/...)', () => {
|
|
81
171
|
it('identifies module pages', () => {
|
|
82
172
|
expect(getFileType(uri('modules/core/public/views/pages/home.liquid'))).toBe(
|
|
@@ -85,6 +175,9 @@ describe('getFileType', () => {
|
|
|
85
175
|
expect(getFileType(uri('modules/core/private/views/pages/admin.liquid'))).toBe(
|
|
86
176
|
PlatformOSFileType.Page,
|
|
87
177
|
);
|
|
178
|
+
expect(getFileType(uri('modules/core/public/pages/home.liquid'))).toBe(
|
|
179
|
+
PlatformOSFileType.Page,
|
|
180
|
+
);
|
|
88
181
|
});
|
|
89
182
|
|
|
90
183
|
it('identifies module layouts', () => {
|
|
@@ -93,13 +186,10 @@ describe('getFileType', () => {
|
|
|
93
186
|
);
|
|
94
187
|
});
|
|
95
188
|
|
|
96
|
-
it('identifies module partials
|
|
189
|
+
it('identifies module partials (views/partials and lib)', () => {
|
|
97
190
|
expect(getFileType(uri('modules/core/public/views/partials/card.liquid'))).toBe(
|
|
98
191
|
PlatformOSFileType.Partial,
|
|
99
192
|
);
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
it('identifies module partials in lib', () => {
|
|
103
193
|
expect(getFileType(uri('modules/core/public/lib/utils.liquid'))).toBe(
|
|
104
194
|
PlatformOSFileType.Partial,
|
|
105
195
|
);
|
|
@@ -108,20 +198,56 @@ describe('getFileType', () => {
|
|
|
108
198
|
);
|
|
109
199
|
});
|
|
110
200
|
|
|
201
|
+
it('identifies module emails', () => {
|
|
202
|
+
expect(getFileType(uri('modules/core/public/emails/welcome.liquid'))).toBe(
|
|
203
|
+
PlatformOSFileType.Email,
|
|
204
|
+
);
|
|
205
|
+
expect(
|
|
206
|
+
getFileType(uri('modules/core/public/notifications/email_notifications/welcome.liquid')),
|
|
207
|
+
).toBe(PlatformOSFileType.Email);
|
|
208
|
+
});
|
|
209
|
+
|
|
111
210
|
it('identifies module smses', () => {
|
|
112
211
|
expect(getFileType(uri('modules/core/public/smses/alert.liquid'))).toBe(
|
|
113
212
|
PlatformOSFileType.Sms,
|
|
114
213
|
);
|
|
214
|
+
expect(
|
|
215
|
+
getFileType(uri('modules/core/public/notifications/sms_notifications/alert.liquid')),
|
|
216
|
+
).toBe(PlatformOSFileType.Sms);
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
it('identifies module api_calls', () => {
|
|
220
|
+
expect(getFileType(uri('modules/core/public/api_calls/fetch.liquid'))).toBe(
|
|
221
|
+
PlatformOSFileType.ApiCall,
|
|
222
|
+
);
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
it('identifies module form_configurations', () => {
|
|
226
|
+
expect(getFileType(uri('modules/core/public/form_configurations/create.liquid'))).toBe(
|
|
227
|
+
PlatformOSFileType.FormConfiguration,
|
|
228
|
+
);
|
|
229
|
+
expect(getFileType(uri('modules/core/public/forms/create.liquid'))).toBe(
|
|
230
|
+
PlatformOSFileType.FormConfiguration,
|
|
231
|
+
);
|
|
115
232
|
});
|
|
116
233
|
|
|
117
234
|
it('identifies module graphql', () => {
|
|
118
235
|
expect(getFileType(uri('modules/core/public/graphql/query.graphql'))).toBe(
|
|
119
236
|
PlatformOSFileType.GraphQL,
|
|
120
237
|
);
|
|
238
|
+
expect(getFileType(uri('modules/core/public/graph_queries/query.graphql'))).toBe(
|
|
239
|
+
PlatformOSFileType.GraphQL,
|
|
240
|
+
);
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
it('identifies module translations', () => {
|
|
244
|
+
expect(getFileType(uri('modules/core/public/translations/en.yml'))).toBe(
|
|
245
|
+
PlatformOSFileType.Translation,
|
|
246
|
+
);
|
|
121
247
|
});
|
|
122
248
|
});
|
|
123
249
|
|
|
124
|
-
describe('app/modules paths', () => {
|
|
250
|
+
describe('app/modules nested paths', () => {
|
|
125
251
|
it('identifies nested module partials in lib', () => {
|
|
126
252
|
expect(getFileType(uri('app/modules/core/public/lib/format.liquid'))).toBe(
|
|
127
253
|
PlatformOSFileType.Partial,
|
|
@@ -133,6 +259,12 @@ describe('getFileType', () => {
|
|
|
133
259
|
PlatformOSFileType.Layout,
|
|
134
260
|
);
|
|
135
261
|
});
|
|
262
|
+
|
|
263
|
+
it('identifies nested module pages', () => {
|
|
264
|
+
expect(getFileType(uri('app/modules/core/public/views/pages/home.liquid'))).toBe(
|
|
265
|
+
PlatformOSFileType.Page,
|
|
266
|
+
);
|
|
267
|
+
});
|
|
136
268
|
});
|
|
137
269
|
|
|
138
270
|
describe('false positive prevention — nested paths must not bleed into wrong type', () => {
|
|
@@ -168,6 +300,12 @@ describe('getFileType', () => {
|
|
|
168
300
|
).toBeUndefined();
|
|
169
301
|
});
|
|
170
302
|
|
|
303
|
+
it('returns undefined for a graphql generator template', () => {
|
|
304
|
+
expect(
|
|
305
|
+
getFileType(uri('modules/core/generators/crud/templates/graphql/create.graphql')),
|
|
306
|
+
).toBeUndefined();
|
|
307
|
+
});
|
|
308
|
+
|
|
171
309
|
it('returns undefined for app/stupid/file.liquid', () => {
|
|
172
310
|
expect(getFileType(uri('app/stupid/file.liquid'))).toBeUndefined();
|
|
173
311
|
});
|
|
@@ -177,14 +315,15 @@ describe('getFileType', () => {
|
|
|
177
315
|
});
|
|
178
316
|
|
|
179
317
|
it('returns undefined for a path that only partially matches', () => {
|
|
180
|
-
// has 'views' but not 'views/pages' or 'views/layouts' etc.
|
|
181
318
|
expect(getFileType(uri('app/views/file.liquid'))).toBeUndefined();
|
|
182
319
|
});
|
|
183
320
|
});
|
|
184
321
|
});
|
|
185
322
|
|
|
323
|
+
// ─── isKnownLiquidFile ────────────────────────────────────────────────────────
|
|
324
|
+
|
|
186
325
|
describe('isKnownLiquidFile', () => {
|
|
187
|
-
it('returns true for all
|
|
326
|
+
it('returns true for all Liquid file types', () => {
|
|
188
327
|
expect(isKnownLiquidFile(uri('app/views/pages/home.liquid'))).toBe(true);
|
|
189
328
|
expect(isKnownLiquidFile(uri('app/views/layouts/default.liquid'))).toBe(true);
|
|
190
329
|
expect(isKnownLiquidFile(uri('app/views/partials/header.liquid'))).toBe(true);
|
|
@@ -194,12 +333,32 @@ describe('isKnownLiquidFile', () => {
|
|
|
194
333
|
expect(isKnownLiquidFile(uri('app/api_calls/create.liquid'))).toBe(true);
|
|
195
334
|
expect(isKnownLiquidFile(uri('app/smses/notify.liquid'))).toBe(true);
|
|
196
335
|
expect(isKnownLiquidFile(uri('app/migrations/001_init.liquid'))).toBe(true);
|
|
336
|
+
expect(isKnownLiquidFile(uri('app/form_configurations/create.liquid'))).toBe(true);
|
|
337
|
+
expect(isKnownLiquidFile(uri('app/forms/create.liquid'))).toBe(true);
|
|
338
|
+
});
|
|
339
|
+
|
|
340
|
+
it('returns true for marketplace_builder Liquid files', () => {
|
|
341
|
+
expect(isKnownLiquidFile(uri('marketplace_builder/views/pages/home.liquid'))).toBe(true);
|
|
342
|
+
expect(isKnownLiquidFile(uri('marketplace_builder/views/partials/header.liquid'))).toBe(true);
|
|
343
|
+
});
|
|
344
|
+
|
|
345
|
+
it('returns true for module Liquid files', () => {
|
|
346
|
+
expect(isKnownLiquidFile(uri('modules/core/public/views/pages/home.liquid'))).toBe(true);
|
|
347
|
+
expect(isKnownLiquidFile(uri('modules/core/public/lib/utils.liquid'))).toBe(true);
|
|
348
|
+
expect(isKnownLiquidFile(uri('modules/core/public/form_configurations/create.liquid'))).toBe(
|
|
349
|
+
true,
|
|
350
|
+
);
|
|
197
351
|
});
|
|
198
352
|
|
|
199
353
|
it('returns false for GraphQL files', () => {
|
|
200
354
|
expect(isKnownLiquidFile(uri('app/graphql/query.graphql'))).toBe(false);
|
|
201
355
|
});
|
|
202
356
|
|
|
357
|
+
it('returns false for YAML files', () => {
|
|
358
|
+
expect(isKnownLiquidFile(uri('app/custom_model_types/property.yml'))).toBe(false);
|
|
359
|
+
expect(isKnownLiquidFile(uri('app/translations/en.yml'))).toBe(false);
|
|
360
|
+
});
|
|
361
|
+
|
|
203
362
|
it('returns false for asset files', () => {
|
|
204
363
|
expect(isKnownLiquidFile(uri('app/assets/app.js'))).toBe(false);
|
|
205
364
|
});
|
|
@@ -217,30 +376,121 @@ describe('isKnownLiquidFile', () => {
|
|
|
217
376
|
});
|
|
218
377
|
});
|
|
219
378
|
|
|
379
|
+
// ─── isKnownGraphQLFile ───────────────────────────────────────────────────────
|
|
380
|
+
|
|
381
|
+
describe('isKnownGraphQLFile', () => {
|
|
382
|
+
it('returns true for app/graphql and app/graph_queries files', () => {
|
|
383
|
+
expect(isKnownGraphQLFile(uri('app/graphql/users.graphql'))).toBe(true);
|
|
384
|
+
expect(isKnownGraphQLFile(uri('app/graph_queries/users.graphql'))).toBe(true);
|
|
385
|
+
expect(isKnownGraphQLFile(uri('app/graphql/nested/create_user.graphql'))).toBe(true);
|
|
386
|
+
});
|
|
387
|
+
|
|
388
|
+
it('returns true for marketplace_builder graphql files', () => {
|
|
389
|
+
expect(isKnownGraphQLFile(uri('marketplace_builder/graphql/query.graphql'))).toBe(true);
|
|
390
|
+
});
|
|
391
|
+
|
|
392
|
+
it('returns true for module graphql files', () => {
|
|
393
|
+
expect(isKnownGraphQLFile(uri('modules/core/public/graphql/query.graphql'))).toBe(true);
|
|
394
|
+
expect(isKnownGraphQLFile(uri('modules/core/private/graphql/mutation.graphql'))).toBe(true);
|
|
395
|
+
expect(isKnownGraphQLFile(uri('modules/core/public/graph_queries/query.graphql'))).toBe(true);
|
|
396
|
+
});
|
|
397
|
+
|
|
398
|
+
it('returns false for generator templates', () => {
|
|
399
|
+
expect(
|
|
400
|
+
isKnownGraphQLFile(uri('modules/core/generators/crud/templates/graphql/create.graphql')),
|
|
401
|
+
).toBe(false);
|
|
402
|
+
});
|
|
403
|
+
|
|
404
|
+
it('returns false for schema files at the project root', () => {
|
|
405
|
+
expect(isKnownGraphQLFile(uri('schema.graphql'))).toBe(false);
|
|
406
|
+
expect(isKnownGraphQLFile(uri('app/schema.graphql'))).toBe(false);
|
|
407
|
+
});
|
|
408
|
+
|
|
409
|
+
it('returns false for liquid files', () => {
|
|
410
|
+
expect(isKnownGraphQLFile(uri('app/views/pages/home.liquid'))).toBe(false);
|
|
411
|
+
});
|
|
412
|
+
});
|
|
413
|
+
|
|
414
|
+
// ─── getAppPaths ──────────────────────────────────────────────────────────────
|
|
415
|
+
|
|
220
416
|
describe('getAppPaths', () => {
|
|
221
|
-
it('
|
|
222
|
-
expect(getAppPaths(PlatformOSFileType.Page)).toEqual(['app/views/pages']);
|
|
417
|
+
it('Page (views/pages + pages)', () => {
|
|
418
|
+
expect(getAppPaths(PlatformOSFileType.Page)).toEqual(['app/views/pages', 'app/pages']);
|
|
223
419
|
});
|
|
224
420
|
|
|
225
|
-
it('
|
|
421
|
+
it('Layout', () => {
|
|
226
422
|
expect(getAppPaths(PlatformOSFileType.Layout)).toEqual(['app/views/layouts']);
|
|
227
423
|
});
|
|
228
424
|
|
|
229
|
-
it('
|
|
425
|
+
it('Partial (views/partials + lib)', () => {
|
|
230
426
|
expect(getAppPaths(PlatformOSFileType.Partial)).toEqual(['app/views/partials', 'app/lib']);
|
|
231
427
|
});
|
|
232
428
|
|
|
233
|
-
it('
|
|
234
|
-
expect(getAppPaths(PlatformOSFileType.
|
|
429
|
+
it('Email (emails + notifications/email_notifications)', () => {
|
|
430
|
+
expect(getAppPaths(PlatformOSFileType.Email)).toEqual([
|
|
431
|
+
'app/emails',
|
|
432
|
+
'app/notifications/email_notifications',
|
|
433
|
+
]);
|
|
434
|
+
});
|
|
435
|
+
|
|
436
|
+
it('ApiCall (api_calls + notifications/api_call_notifications)', () => {
|
|
437
|
+
expect(getAppPaths(PlatformOSFileType.ApiCall)).toEqual([
|
|
438
|
+
'app/api_calls',
|
|
439
|
+
'app/notifications/api_call_notifications',
|
|
440
|
+
]);
|
|
441
|
+
});
|
|
442
|
+
|
|
443
|
+
it('Sms (smses + notifications/sms_notifications)', () => {
|
|
444
|
+
expect(getAppPaths(PlatformOSFileType.Sms)).toEqual([
|
|
445
|
+
'app/smses',
|
|
446
|
+
'app/notifications/sms_notifications',
|
|
447
|
+
]);
|
|
235
448
|
});
|
|
236
449
|
|
|
237
|
-
it('
|
|
450
|
+
it('FormConfiguration (form_configurations + forms)', () => {
|
|
451
|
+
expect(getAppPaths(PlatformOSFileType.FormConfiguration)).toEqual([
|
|
452
|
+
'app/form_configurations',
|
|
453
|
+
'app/forms',
|
|
454
|
+
]);
|
|
455
|
+
});
|
|
456
|
+
|
|
457
|
+
it('CustomModelType (3 aliases)', () => {
|
|
458
|
+
expect(getAppPaths(PlatformOSFileType.CustomModelType)).toEqual([
|
|
459
|
+
'app/custom_model_types',
|
|
460
|
+
'app/model_schemas',
|
|
461
|
+
'app/schema',
|
|
462
|
+
]);
|
|
463
|
+
});
|
|
464
|
+
|
|
465
|
+
it('InstanceProfileType (3 aliases)', () => {
|
|
466
|
+
expect(getAppPaths(PlatformOSFileType.InstanceProfileType)).toEqual([
|
|
467
|
+
'app/instance_profile_types',
|
|
468
|
+
'app/user_profile_types',
|
|
469
|
+
'app/user_profile_schemas',
|
|
470
|
+
]);
|
|
471
|
+
});
|
|
472
|
+
|
|
473
|
+
it('TransactableType', () => {
|
|
474
|
+
expect(getAppPaths(PlatformOSFileType.TransactableType)).toEqual(['app/transactable_types']);
|
|
475
|
+
});
|
|
476
|
+
|
|
477
|
+
it('Translation', () => {
|
|
478
|
+
expect(getAppPaths(PlatformOSFileType.Translation)).toEqual(['app/translations']);
|
|
479
|
+
});
|
|
480
|
+
|
|
481
|
+
it('GraphQL (graphql + graph_queries)', () => {
|
|
482
|
+
expect(getAppPaths(PlatformOSFileType.GraphQL)).toEqual(['app/graphql', 'app/graph_queries']);
|
|
483
|
+
});
|
|
484
|
+
|
|
485
|
+
it('Asset', () => {
|
|
238
486
|
expect(getAppPaths(PlatformOSFileType.Asset)).toEqual(['app/assets']);
|
|
239
487
|
});
|
|
240
488
|
});
|
|
241
489
|
|
|
490
|
+
// ─── getModulePaths ───────────────────────────────────────────────────────────
|
|
491
|
+
|
|
242
492
|
describe('getModulePaths', () => {
|
|
243
|
-
it('returns all 8 module paths for Partial', () => {
|
|
493
|
+
it('returns all 8 module paths for Partial (2 dirs × 4 roots)', () => {
|
|
244
494
|
expect(getModulePaths(PlatformOSFileType.Partial, 'mymodule')).toEqual([
|
|
245
495
|
'app/modules/mymodule/public/views/partials',
|
|
246
496
|
'app/modules/mymodule/private/views/partials',
|
|
@@ -253,12 +503,16 @@ describe('getModulePaths', () => {
|
|
|
253
503
|
]);
|
|
254
504
|
});
|
|
255
505
|
|
|
256
|
-
it('returns all
|
|
506
|
+
it('returns all 8 module paths for GraphQL (graphql + graph_queries)', () => {
|
|
257
507
|
expect(getModulePaths(PlatformOSFileType.GraphQL, 'mymodule')).toEqual([
|
|
258
508
|
'app/modules/mymodule/public/graphql',
|
|
259
509
|
'app/modules/mymodule/private/graphql',
|
|
260
510
|
'modules/mymodule/public/graphql',
|
|
261
511
|
'modules/mymodule/private/graphql',
|
|
512
|
+
'app/modules/mymodule/public/graph_queries',
|
|
513
|
+
'app/modules/mymodule/private/graph_queries',
|
|
514
|
+
'modules/mymodule/public/graph_queries',
|
|
515
|
+
'modules/mymodule/private/graph_queries',
|
|
262
516
|
]);
|
|
263
517
|
});
|
|
264
518
|
|
|
@@ -268,10 +522,16 @@ describe('getModulePaths', () => {
|
|
|
268
522
|
'app/modules/core/private/views/pages',
|
|
269
523
|
'modules/core/public/views/pages',
|
|
270
524
|
'modules/core/private/views/pages',
|
|
525
|
+
'app/modules/core/public/pages',
|
|
526
|
+
'app/modules/core/private/pages',
|
|
527
|
+
'modules/core/public/pages',
|
|
528
|
+
'modules/core/private/pages',
|
|
271
529
|
]);
|
|
272
530
|
});
|
|
273
531
|
});
|
|
274
532
|
|
|
533
|
+
// ─── convenience predicates ───────────────────────────────────────────────────
|
|
534
|
+
|
|
275
535
|
describe('type predicate convenience functions', () => {
|
|
276
536
|
describe('isPartial', () => {
|
|
277
537
|
it('returns true for views/partials', () => {
|
|
@@ -302,6 +562,14 @@ describe('type predicate convenience functions', () => {
|
|
|
302
562
|
expect(isPage(uri('app/views/pages/home.liquid'))).toBe(true);
|
|
303
563
|
});
|
|
304
564
|
|
|
565
|
+
it('returns true for app/pages (legacy alias)', () => {
|
|
566
|
+
expect(isPage(uri('app/pages/home.liquid'))).toBe(true);
|
|
567
|
+
});
|
|
568
|
+
|
|
569
|
+
it('returns true for marketplace_builder/views/pages', () => {
|
|
570
|
+
expect(isPage(uri('marketplace_builder/views/pages/home.liquid'))).toBe(true);
|
|
571
|
+
});
|
|
572
|
+
|
|
305
573
|
it('returns false for layouts', () => {
|
|
306
574
|
expect(isPage(uri('app/views/layouts/default.liquid'))).toBe(false);
|
|
307
575
|
});
|
|
@@ -312,6 +580,10 @@ describe('type predicate convenience functions', () => {
|
|
|
312
580
|
expect(isLayout(uri('app/views/layouts/default.liquid'))).toBe(true);
|
|
313
581
|
});
|
|
314
582
|
|
|
583
|
+
it('returns true for marketplace_builder/views/layouts', () => {
|
|
584
|
+
expect(isLayout(uri('marketplace_builder/views/layouts/default.liquid'))).toBe(true);
|
|
585
|
+
});
|
|
586
|
+
|
|
315
587
|
it('returns true for module layouts', () => {
|
|
316
588
|
expect(isLayout(uri('modules/core/public/views/layouts/default.liquid'))).toBe(true);
|
|
317
589
|
});
|
|
@@ -328,16 +600,19 @@ describe('type predicate convenience functions', () => {
|
|
|
328
600
|
|
|
329
601
|
it('isEmail', () => {
|
|
330
602
|
expect(isEmail(uri('app/emails/welcome.liquid'))).toBe(true);
|
|
603
|
+
expect(isEmail(uri('app/notifications/email_notifications/welcome.liquid'))).toBe(true);
|
|
331
604
|
expect(isEmail(uri('app/lib/emails/welcome.liquid'))).toBe(false);
|
|
332
605
|
});
|
|
333
606
|
|
|
334
607
|
it('isApiCall', () => {
|
|
335
608
|
expect(isApiCall(uri('app/api_calls/create.liquid'))).toBe(true);
|
|
609
|
+
expect(isApiCall(uri('app/notifications/api_call_notifications/create.liquid'))).toBe(true);
|
|
336
610
|
expect(isApiCall(uri('app/lib/api_calls/create.liquid'))).toBe(false);
|
|
337
611
|
});
|
|
338
612
|
|
|
339
613
|
it('isSms', () => {
|
|
340
614
|
expect(isSms(uri('app/smses/notify.liquid'))).toBe(true);
|
|
615
|
+
expect(isSms(uri('app/notifications/sms_notifications/notify.liquid'))).toBe(true);
|
|
341
616
|
expect(isSms(uri('app/lib/smses/notify.liquid'))).toBe(false);
|
|
342
617
|
expect(isSms(uri('modules/core/public/smses/notify.liquid'))).toBe(true);
|
|
343
618
|
expect(isSms(uri('modules/core/public/lib/smses/notify.liquid'))).toBe(false);
|
|
@@ -347,4 +622,16 @@ describe('type predicate convenience functions', () => {
|
|
|
347
622
|
expect(isMigration(uri('app/migrations/001_init.liquid'))).toBe(true);
|
|
348
623
|
expect(isMigration(uri('app/lib/migrations/001_init.liquid'))).toBe(false);
|
|
349
624
|
});
|
|
625
|
+
|
|
626
|
+
it('isFormConfiguration', () => {
|
|
627
|
+
expect(isFormConfiguration(uri('app/form_configurations/create_user.liquid'))).toBe(true);
|
|
628
|
+
expect(isFormConfiguration(uri('app/forms/create_user.liquid'))).toBe(true);
|
|
629
|
+
expect(isFormConfiguration(uri('modules/core/public/form_configurations/create.liquid'))).toBe(
|
|
630
|
+
true,
|
|
631
|
+
);
|
|
632
|
+
expect(isFormConfiguration(uri('marketplace_builder/form_configurations/create.liquid'))).toBe(
|
|
633
|
+
true,
|
|
634
|
+
);
|
|
635
|
+
expect(isFormConfiguration(uri('app/lib/create_user.liquid'))).toBe(false);
|
|
636
|
+
});
|
|
350
637
|
});
|