@postxl/generator 0.0.20 → 0.0.22

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.
Files changed (31) hide show
  1. package/README.md +2 -2
  2. package/dist/jest.config.js +17 -0
  3. package/dist/src/generator.js +13 -13
  4. package/dist/src/generators/enums/react.generator.js +55 -55
  5. package/dist/src/generators/enums/types.generator.js +8 -8
  6. package/dist/src/generators/indices/datamockmodule.generator.js +46 -46
  7. package/dist/src/generators/indices/datamodule.generator.js +76 -76
  8. package/dist/src/generators/indices/dataservice.generator.js +26 -26
  9. package/dist/src/generators/indices/repositories.generator.js +3 -3
  10. package/dist/src/generators/indices/testdataservice.generator.js +23 -22
  11. package/dist/src/generators/models/react.generator/context.generator.js +47 -47
  12. package/dist/src/generators/models/react.generator/index.js +8 -8
  13. package/dist/src/generators/models/react.generator/library.generator.js +66 -66
  14. package/dist/src/generators/models/react.generator/lookup.generator.js +75 -75
  15. package/dist/src/generators/models/react.generator/modals.generator.js +261 -261
  16. package/dist/src/generators/models/repository.generator.js +239 -239
  17. package/dist/src/generators/models/route.generator.js +45 -45
  18. package/dist/src/generators/models/seed.generator.js +14 -14
  19. package/dist/src/generators/models/stub.generator.js +19 -19
  20. package/dist/src/generators/models/types.generator.js +39 -39
  21. package/dist/src/lib/vfs.js +2 -2
  22. package/dist/tsconfig.tsbuildinfo +1 -1
  23. package/package.json +8 -2
  24. package/changelog.md +0 -115
  25. package/jest.config.ts +0 -18
  26. package/tests/attributes.test.ts +0 -91
  27. package/tests/file.test.ts +0 -32
  28. package/tests/schemas/la/la.prisma +0 -862
  29. package/tests/schemas/mca/mca.prisma +0 -528
  30. package/tests/utils/random.ts +0 -11
  31. package/tests/vfs.test.ts +0 -92
@@ -1,528 +0,0 @@
1
- generator client {
2
- provider = "prisma-client-js"
3
- output = "../../../node_modules/@prisma/db"
4
- }
5
-
6
- generator pxl {
7
- provider = "node ./dist/src/generator.js"
8
- project = "mca"
9
-
10
- pathToTypes = "./tests/schemas/mca/generated/backend/libs/types/src/"
11
- pathToDataLib = "./tests/schemas/mca/generated/backend/libs/data/src/"
12
- trpcRoutesFolder = "./tests/schemas/mca/generated/backend/libs/trpc/src/routes/"
13
- pathToSeedLib = "./tests/schemas/mca/generated/backend/libs/seed/src/"
14
-
15
- reactFolderOutput = "./tests/schemas/mca/generated/web/src/components/"
16
-
17
- randomSeed = 1
18
- force = false
19
- }
20
-
21
- datasource db {
22
- provider = "postgresql"
23
- url = env("DATABASE_CONNECTION")
24
- }
25
-
26
- model TherapeuticArea {
27
- id String @id @default(cuid())
28
- createdAt DateTime @default(now())
29
- updatedAt DateTime? @updatedAt
30
-
31
- name String @unique
32
- description String
33
-
34
- brands Brand[] @relation("Brand_TherapeuticArea_therapeuticAreaId")
35
- indications Indication[] @relation("Indication_TherapeuticArea_therapeuticAreaId")
36
- }
37
-
38
- model Audience {
39
- id String @id @default(cuid())
40
- createdAt DateTime @default(now())
41
- updatedAt DateTime? @updatedAt
42
-
43
- ///@@MaxLength(255)
44
- name String @unique @db.VarChar(255)
45
- description String
46
- iconUrl String?
47
-
48
- assets Asset[] @relation("Asset_Audience_audienceId")
49
- }
50
-
51
- model Channel {
52
- id String @id @default(cuid())
53
- createdAt DateTime @default(now())
54
- updatedAt DateTime? @updatedAt
55
-
56
- ///@@MaxLength(255)
57
- name String @unique @db.VarChar(255)
58
- description String
59
-
60
- assets Asset[] @relation("Asset_Channel_channelId")
61
- }
62
-
63
- model Brand {
64
- id String @id @default(cuid())
65
- createdAt DateTime @default(now())
66
- updatedAt DateTime? @updatedAt
67
-
68
- name String @unique
69
- description String
70
- iconUrl String?
71
-
72
- therapeuticArea TherapeuticArea @relation("Brand_TherapeuticArea_therapeuticAreaId", fields: [therapeuticAreaId], references: [id])
73
- therapeuticAreaId String
74
-
75
- assets Asset[] @relation("Asset_Brand_brandId")
76
- components Component[] @relation("Component_Brand_brandId")
77
- }
78
-
79
- model Indication {
80
- id String @id @default(cuid())
81
- createdAt DateTime @default(now())
82
- updatedAt DateTime? @updatedAt
83
-
84
- name String @unique
85
- description String
86
- iconUrl String?
87
-
88
- therapeuticArea TherapeuticArea @relation("Indication_TherapeuticArea_therapeuticAreaId", fields: [therapeuticAreaId], references: [id])
89
- therapeuticAreaId String
90
-
91
- assets Asset[] @relation("Asset_Indication_indicationId")
92
- component Component[] @relation("Component_Indication_indicationId")
93
- }
94
-
95
- model MustWinMoment {
96
- id String @id @default(cuid())
97
- createdAt DateTime @default(now())
98
- updatedAt DateTime? @updatedAt
99
-
100
- ///@@MaxLength(255)
101
- name String @unique @db.VarChar(255)
102
- description String
103
- iconUrl String?
104
-
105
- assets Asset[] @relation("Asset_MustWinMoment_mustWinMomentId")
106
- }
107
-
108
- model MessageType {
109
- id String @id @default(cuid())
110
- createdAt DateTime @default(now())
111
- updatedAt DateTime? @updatedAt
112
-
113
- ///@@MaxLength(255)
114
- name String @unique @db.VarChar(255)
115
- description String
116
- isBranded Boolean @default(false)
117
-
118
- messages Message[] @relation("Message_MessageType_messageTypeId")
119
- }
120
-
121
- model Message {
122
- id String @id @default(cuid())
123
- createdAt DateTime @default(now())
124
- updatedAt DateTime? @updatedAt
125
-
126
- ///@@MaxLength(255)
127
- name String @unique @db.VarChar(255)
128
- description String
129
-
130
- messageTypeId String
131
- messageType MessageType @relation("Message_MessageType_messageTypeId", fields: [messageTypeId], references: [id])
132
-
133
- components Component[] @relation("Component_Message_messageId")
134
- }
135
-
136
- model ComponentType {
137
- id String @id @default(cuid())
138
- createdAt DateTime @default(now())
139
- updatedAt DateTime? @updatedAt
140
-
141
- ///@@MaxLength(255)
142
- name String @unique @db.VarChar(255)
143
- description String
144
- isNotation Boolean @default(false)
145
-
146
- components Component[] @relation("Component_ComponentType_componentTypeId")
147
- }
148
-
149
- /// @@TRPC_SkipCreate("")
150
- /// @@TRPC_CustomUpdate("")
151
- model Component {
152
- id String @id @default(cuid())
153
- createdAt DateTime @default(now())
154
- updatedAt DateTime? @updatedAt
155
-
156
- ///@@MaxLength(255)
157
- name String @unique @db.VarChar(255)
158
- description String
159
- contentText String
160
-
161
- contentUrl String?
162
- imageWidth Int?
163
- imageHeight Int?
164
-
165
- status ApprovalStatus
166
-
167
- componentTypeId String
168
- componentType ComponentType @relation("Component_ComponentType_componentTypeId", fields: [componentTypeId], references: [id])
169
-
170
- message Message? @relation("Component_Message_messageId", fields: [messageId], references: [id])
171
- messageId String?
172
-
173
- country Country @relation("Component_Country_countryId", fields: [countryId], references: [id])
174
- countryId String
175
- language Language @relation("Component_Language_languageId", fields: [languageId], references: [id])
176
- languageId String
177
- brand Brand? @relation("Component_Brand_brandId", fields: [brandId], references: [id])
178
- brandId String?
179
- indication Indication? @relation("Component_Indication_indicationId", fields: [indicationId], references: [id])
180
- indicationId String?
181
-
182
- parent Component? @relation("Component_Component_parentId", fields: [parentId], references: [id])
183
- parentId String?
184
- children Component[] @relation("Component_Component_parentId")
185
-
186
- notationsFrom Notation[] @relation("Component_Component_sourceId")
187
- notationsTo Notation[] @relation("Component_Component_targetId")
188
-
189
- businessRules BusinessRule[] @relation("BusinessRule_Component_componentId")
190
- }
191
-
192
- /// @@TRPC_CustomCreate("")
193
- /// @@TRPC_CustomUpdate("")
194
- model Notation {
195
- id String @id @default(cuid())
196
- createdAt DateTime @default(now())
197
- updatedAt DateTime? @updatedAt
198
-
199
- label String
200
- description String
201
-
202
- source Component @relation("Component_Component_sourceId", fields: [sourceId], references: [id])
203
- sourceId String
204
- target Component @relation("Component_Component_targetId", fields: [targetId], references: [id])
205
- targetId String
206
- }
207
-
208
- /// @@TRPC_CustomCreate("")
209
- /// @@TRPC_CustomUpdate("")
210
- model BusinessRule {
211
- id String @id @default(cuid())
212
- createdAt DateTime @default(now())
213
- updatedAt DateTime? @updatedAt
214
-
215
- label String
216
- description String
217
- order Float
218
- prominence Int @default(0)
219
-
220
- story Story @relation("BusinessRule_Story_storyId", fields: [storyId], references: [id])
221
- storyId String
222
- component Component @relation("BusinessRule_Component_componentId", fields: [componentId], references: [id])
223
- componentId String
224
-
225
- assetTypes BusinessRuleAssetType[] @relation("BusinessRuleAssetType_BusinessRule_businessRuleId")
226
- storypages StoryPageBusinessRule[] @relation("StoryPageBusinessRule_BusinessRule_businessRuleId")
227
- }
228
-
229
- /// @@TRPC_CustomCreate("")
230
- /// @@TRPC_CustomUpdate("")
231
- /// The specification of how a component - a business rule - should behave in a specific context.
232
- model BusinessRuleAssetType {
233
- id String @id @default(cuid())
234
- createdAt DateTime @default(now())
235
- updatedAt DateTime? @updatedAt
236
-
237
- label String
238
- description String
239
- size ComponentSize
240
- requirement ComponentRequirement
241
-
242
- style Style @relation("BusinessRuleAssetType_Style_styleId", fields: [styleId], references: [id])
243
- styleId String
244
-
245
- businessRule BusinessRule @relation("BusinessRuleAssetType_BusinessRule_businessRuleId", fields: [businessRuleId], references: [id])
246
- businessRuleId String
247
- assetType AssetType @relation("BusinessRuleAssetType_AssetType_assetTypeId", fields: [assetTypeId], references: [id])
248
- assetTypeId String
249
-
250
- storypages StoryPageBusinessRule[] @relation("StoryPageBusinessRule_BusinessRuleAssetType_businessRuleAssetTypeId")
251
- }
252
-
253
- enum ComponentSize {
254
- Small
255
- Medium
256
- Large
257
- XLarge
258
- }
259
-
260
- /// @@TRPC_CustomCreate("")
261
- /// @@TRPC_CustomUpdate("")
262
- model Story {
263
- id String @id @default(cuid())
264
- createdAt DateTime @default(now())
265
- updatedAt DateTime? @updatedAt
266
-
267
- ///@@MaxLength(255)
268
- name String @unique @db.VarChar(255)
269
- label String
270
- description String
271
-
272
- businessRules BusinessRule[] @relation("BusinessRule_Story_storyId")
273
-
274
- status ApprovalStatus @default(Draft)
275
-
276
- renderedUrl String?
277
- imageWidth Int?
278
- imageHeight Int?
279
-
280
- country Country @relation("Story_Country_countryId", fields: [countryId], references: [id])
281
- countryId String
282
- language Language @relation("Story_Language_languageId", fields: [languageId], references: [id])
283
- languageId String
284
- storyPages StoryPage[] @relation("StoryPage_Story_storyId")
285
-
286
- parent Story? @relation("Story_Story_parentId", fields: [parentId], references: [id])
287
- parentId String?
288
- children Story[] @relation("Story_Story_parentId")
289
-
290
- storySubjectRelations StoryRelation[] @relation("StoryRelation_Story_storySubjectId")
291
- storyObjectRelations StoryRelation[] @relation("StoryRelation_Story_storyObjectId")
292
- }
293
-
294
- /// Dependencies between different stories.
295
- model StoryRelation {
296
- id String @id @default(cuid())
297
- createdAt DateTime @default(now())
298
- updatedAt DateTime? @updatedAt
299
-
300
- label String?
301
- description String?
302
-
303
- storySubject Story @relation("StoryRelation_Story_storySubjectId", fields: [storySubjectId], references: [id])
304
- storySubjectId String
305
- storyObject Story @relation("StoryRelation_Story_storyObjectId", fields: [storyObjectId], references: [id])
306
- storyObjectId String
307
-
308
- relation StoryRelationType
309
- }
310
-
311
- enum StoryRelationType {
312
- HasToBeUsedWith
313
- CanNotBeUsedWith
314
- HasToBeUsedBefore
315
- HasToBeUsedAfter
316
- HasToBeUsedNextTo
317
- }
318
-
319
- /// @@TRPC_CustomCreate("")
320
- /// @@TRPC_CustomUpdate("")
321
- model Asset {
322
- id String @id @default(cuid())
323
- createdAt DateTime @default(now())
324
- updatedAt DateTime? @updatedAt
325
-
326
- ///@@MaxLength(255)
327
- name String @unique @db.VarChar(255)
328
- label String
329
- description String
330
-
331
- storyPages StoryPage[] @relation("StoryPage_Asset_assetId")
332
-
333
- renderedUrl String?
334
- imageWidth Int?
335
- imageHeight Int?
336
-
337
- status AssetApprovalStatus
338
- approvalComment String
339
-
340
- assetType AssetType @relation("Asset_AssetType_assetTypeId", fields: [assetTypeId], references: [id])
341
- assetTypeId String
342
- brand Brand @relation("Asset_Brand_brandId", fields: [brandId], references: [id])
343
- brandId String
344
- indication Indication @relation("Asset_Indication_indicationId", fields: [indicationId], references: [id])
345
- indicationId String
346
- country Country @relation("Asset_Country_countryId", fields: [countryId], references: [id])
347
- countryId String
348
- language Language @relation("Asset_Language_languageId", fields: [languageId], references: [id])
349
- languageId String
350
- audience Audience @relation("Asset_Audience_audienceId", fields: [audienceId], references: [id])
351
- audienceId String
352
- channel Channel @relation("Asset_Channel_channelId", fields: [channelId], references: [id])
353
- channelId String
354
- mustWinMoment MustWinMoment @relation("Asset_MustWinMoment_mustWinMomentId", fields: [mustWinMomentId], references: [id])
355
- mustWinMomentId String
356
-
357
- parent Asset? @relation("Asset_Asset_parentId", fields: [parentId], references: [id])
358
- parentId String?
359
- children Asset[] @relation("Asset_Asset_parentId")
360
- }
361
-
362
- enum AssetApprovalStatus {
363
- Draft
364
- IsVariant
365
- Update
366
- Approved
367
- }
368
-
369
- /// @@TRPC_CustomCreate("")
370
- /// @@TRPC_CustomUpdate("")
371
- model StoryPage {
372
- id String @id @default(cuid())
373
- createdAt DateTime @default(now())
374
- updatedAt DateTime? @updatedAt
375
-
376
- label String
377
- pageNumber Int
378
- description String
379
-
380
- renderedUrl String?
381
- imageWidth Int?
382
- imageHeight Int?
383
-
384
- story Story @relation("StoryPage_Story_storyId", fields: [storyId], references: [id])
385
- storyId String
386
- asset Asset @relation("StoryPage_Asset_assetId", fields: [assetId], references: [id])
387
- assetId String
388
-
389
- isApproved Boolean @default(false)
390
- approvalComment String
391
-
392
- storyPageBusinessRules StoryPageBusinessRule[] @relation("StoryPageBusinessRule_StoryPage_storyPageId")
393
- }
394
-
395
- /// A configuration of a given business rule inside a given story page (i.e. a story in an asset).
396
- model StoryPageBusinessRule {
397
- id String @id @default(cuid())
398
- createdAt DateTime @default(now())
399
- updatedAt DateTime? @updatedAt
400
-
401
- storyPageId String
402
- storyPage StoryPage @relation("StoryPageBusinessRule_StoryPage_storyPageId", fields: [storyPageId], references: [id])
403
- businessRuleAssetTypeId String
404
- businessRuleAssetType BusinessRuleAssetType @relation("StoryPageBusinessRule_BusinessRuleAssetType_businessRuleAssetTypeId", fields: [businessRuleAssetTypeId], references: [id])
405
- businessRuleId String
406
- businessRule BusinessRule @relation("StoryPageBusinessRule_BusinessRule_businessRuleId", fields: [businessRuleId], references: [id])
407
-
408
- isIncluded Boolean @default(true)
409
- isApproved Boolean @default(false)
410
- approvalComment String
411
-
412
- @@unique([storyPageId, businessRuleAssetTypeId])
413
- }
414
-
415
- model Country {
416
- id String @id @default(cuid())
417
- createdAt DateTime @default(now())
418
- updatedAt DateTime? @updatedAt
419
-
420
- ///@@MaxLength(255)
421
- name String @unique @db.VarChar(255)
422
- description String
423
- ///@@IsLabel()
424
- countryCode String //"US", "DE", "AT"
425
-
426
- defaultLanguage Language? @relation("Country_Language_defaultLanguageId", fields: [defaultLanguageId], references: [id])
427
- defaultLanguageId String?
428
-
429
- components Component[] @relation("Component_Country_countryId")
430
- assets Asset[] @relation("Asset_Country_countryId")
431
- stories Story[] @relation("Story_Country_countryId")
432
-
433
- ///@@IsDefault()
434
- isGlobal Boolean @default(false) // true if country is global default
435
- }
436
-
437
- model Language {
438
- id String @id @default(cuid())
439
- createdAt DateTime @default(now())
440
- updatedAt DateTime? @updatedAt
441
-
442
- ///@@MaxLength(255)
443
- name String @unique @db.VarChar(255)
444
- description String
445
- languageCode String //"en", "de"
446
-
447
- ///@@IsDefault()
448
- isGlobal Boolean @default(false) // true if language is global default
449
-
450
- defaultCountries Country[] @relation("Country_Language_defaultLanguageId")
451
- components Component[] @relation("Component_Language_languageId")
452
- assets Asset[] @relation("Asset_Language_languageId")
453
- stories Story[] @relation("Story_Language_languageId")
454
- }
455
-
456
- model Style {
457
- id String @id @default(cuid())
458
- createdAt DateTime @default(now())
459
- updatedAt DateTime? @updatedAt
460
-
461
- ///@@MaxLength(255)
462
- name String @unique @db.VarChar(255)
463
- description String
464
- styleType StyleType
465
-
466
- businessRuleAssetTypes BusinessRuleAssetType[] @relation("BusinessRuleAssetType_Style_styleId")
467
- assetTypes AssetType[] @relation("AssetType_Style_defaultStyleId")
468
- }
469
-
470
- enum StyleType {
471
- Text
472
- Graphic
473
- Video
474
- Audio
475
- Code
476
- PDF
477
- }
478
-
479
- enum ComponentRequirement {
480
- RequiredInStory
481
- RequiredOncePerPage
482
- RequiredOncePerPiece
483
- RequiredOneClickAway
484
- Optional
485
- }
486
-
487
- model AssetType {
488
- // LeaveBehind
489
- // BannerAd
490
- // Email
491
- // SocialMedia
492
- // Video
493
- // PDF
494
- id String @id @default(cuid())
495
- createdAt DateTime @default(now())
496
- updatedAt DateTime? @updatedAt
497
-
498
- ///@@MaxLength(255)
499
- name String @unique @db.VarChar(255)
500
- description String
501
- iconUrl String?
502
-
503
- defaultStyle Style @relation("AssetType_Style_defaultStyleId", fields: [defaultStyleId], references: [id])
504
- defaultStyleId String
505
- defaultSize ComponentSize
506
- defaultRequirement ComponentRequirement
507
-
508
- assets Asset[] @relation("Asset_AssetType_assetTypeId")
509
- businessRuleAssetTypes BusinessRuleAssetType[] @relation("BusinessRuleAssetType_AssetType_assetTypeId")
510
- }
511
-
512
- enum ApprovalStatus {
513
- // A given object has been created and never used.
514
- Draft
515
-
516
- // Someone has confirmed the use of a given object in an asset.
517
- Approved
518
-
519
- // A given object has been used, but something has changed and someone needs to re-confirm
520
- // the change in one of the assets that uses it.
521
- Updated
522
- }
523
-
524
- /// @@Global_Ignore("Used for internal configuration of database, not to be exposed to client")
525
- model Config {
526
- id Boolean @id @default(true)
527
- isTest Boolean @default(false)
528
- }
@@ -1,11 +0,0 @@
1
- const ALPHANUMERIC_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
2
-
3
- export namespace RandomUtils {
4
- export function generateRandomAlphaNumericString(len: number): string {
5
- let text = ''
6
- for (let i = 0; i < len; i++) {
7
- text += ALPHANUMERIC_CHARS.charAt(Math.floor(Math.random() * ALPHANUMERIC_CHARS.length))
8
- }
9
- return text
10
- }
11
- }
package/tests/vfs.test.ts DELETED
@@ -1,92 +0,0 @@
1
- import { VirtualFS } from '../src/lib/vfs'
2
- import { RandomUtils } from './utils/random'
3
-
4
- function adjustPathToOS(path: string) {
5
- return path.replace(/\//g, process.platform === 'win32' ? '\\' : '/')
6
- }
7
- describe('virtual file system', () => {
8
- test('IO works', () => {
9
- const vfs = new VirtualFS()
10
-
11
- const files = []
12
-
13
- for (let depth = 0; depth < 100; depth++) {
14
- const path = '/folder'.repeat(depth) + '/file.txt'
15
- const content = RandomUtils.generateRandomAlphaNumericString(160)
16
- const status = vfs.write(path, content)
17
-
18
- expect(status.ok).toBeTruthy()
19
-
20
- files.push({ path, content })
21
- }
22
-
23
- for (const { path, content } of files) {
24
- const file = vfs.read(path)
25
- expect(file).toEqual({ ok: true, content })
26
- }
27
- })
28
-
29
- test('lists files correctly', () => {
30
- const vfs = new VirtualFS()
31
-
32
- vfs.write('/a.txt', 'a')
33
- vfs.write('/b.txt', 'b')
34
- vfs.write('/c.txt', 'c')
35
-
36
- vfs.write('/sub/a.txt', 'a')
37
- vfs.write('/sub/b.txt', 'b')
38
- vfs.write('/sub/c.txt', 'c')
39
-
40
- const files = vfs.list('/')
41
- const subFiles = vfs.list('/sub')
42
-
43
- expect(files).toHaveLength(4)
44
- expect(files).toContainEqual({ kind: 'FILE', name: 'a.txt' })
45
- expect(files).toContainEqual({ kind: 'FILE', name: 'b.txt' })
46
- expect(files).toContainEqual({ kind: 'FILE', name: 'c.txt' })
47
- expect(files).toContainEqual({ kind: 'FOLDER', name: 'sub' })
48
-
49
- expect(subFiles).toHaveLength(3)
50
- expect(subFiles).toContainEqual({ kind: 'FILE', name: 'a.txt' })
51
- expect(subFiles).toContainEqual({ kind: 'FILE', name: 'b.txt' })
52
- expect(subFiles).toContainEqual({ kind: 'FILE', name: 'c.txt' })
53
- })
54
-
55
- test('lists folders correctly', () => {
56
- const vfs = new VirtualFS()
57
-
58
- vfs.write('/a/b/a/file.txt', 'a')
59
- vfs.write('/a/b/b/file.txt', 'b')
60
- vfs.write('/a/b/c/file.txt', 'c')
61
- vfs.write('/a/b/d/file.txt', 'd')
62
-
63
- const folders = vfs.list('/a/b')
64
-
65
- expect(folders).toHaveLength(4)
66
- expect(folders).toContainEqual({ kind: 'FOLDER', name: 'a' })
67
- expect(folders).toContainEqual({ kind: 'FOLDER', name: 'b' })
68
- expect(folders).toContainEqual({ kind: 'FOLDER', name: 'c' })
69
- expect(folders).toContainEqual({ kind: 'FOLDER', name: 'd' })
70
- })
71
-
72
- test('copies files correctly', () => {
73
- const vfs = new VirtualFS()
74
-
75
- const src = new VirtualFS()
76
- src.write('/a.txt', 'a')
77
- src.write('/b.txt', 'b')
78
- src.write('/c.txt', 'c')
79
-
80
- vfs.copy(src, '/')
81
- vfs.copy(src, '/sub')
82
-
83
- expect(vfs.files()).toEqual({
84
- [adjustPathToOS('/a.txt')]: 'a',
85
- [adjustPathToOS('/b.txt')]: 'b',
86
- [adjustPathToOS('/c.txt')]: 'c',
87
- [adjustPathToOS('/sub/a.txt')]: 'a',
88
- [adjustPathToOS('/sub/b.txt')]: 'b',
89
- [adjustPathToOS('/sub/c.txt')]: 'c',
90
- })
91
- })
92
- })