@domain-first/project-structure 8.7.0 → 8.7.1

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/dist/287.js CHANGED
@@ -127,23 +127,6 @@ export const wireInMemoryDbInfrastructureService = wireClass(
127
127
  []
128
128
  );
129
129
  `;
130
- const inMemoryDbSpec = (testingLibrary, withWiring)=>`
131
- import { describe, test, expect, beforeEach } from '${testingLibrary}'
132
- ${withWiring ? `import { type InMemoryDbInfrastructureService } from './in-memory-db-infrastructure-service'
133
- import { wireInMemoryDbInfrastructureService } from '../../wiring/infrastructure-services/wire-in-memory-db-infrastructure-service'` : "import { InMemoryDbInfrastructureService } from './in-memory-db-infrastructure-service'"}
134
-
135
- let inMemoryDbInfrastructureService: InMemoryDbInfrastructureService
136
-
137
- beforeEach(() => {
138
- inMemoryDbInfrastructureService = ${withWiring ? 'wireInMemoryDbInfrastructureService()' : 'new InMemoryDbInfrastructureService()'}
139
- })
140
-
141
- describe('in memory db', () => {
142
- test('can be ${withWiring ? 'wired' : 'created'}', () => {
143
- expect(inMemoryDbInfrastructureService).toBeDefined()
144
- })
145
- })
146
- `.trim();
147
130
  const in_memory_db_withWiring = ()=>ConfigFile.backend.domainFirstPackages.includes('@domain-first/wire');
148
131
  const in_memory_db_sharedFolder = ()=>new Folder(new ProjectRoot().path).subitem([
149
132
  ConfigFile.Instance.data.project.rootFolder,
@@ -160,13 +143,11 @@ const in_memory_db_wireFile = ()=>new File(in_memory_db_sharedFolder().path).sub
160
143
  'wire-in-memory-db-infrastructure-service.ts'
161
144
  ]);
162
145
  const scaffoldInMemoryDb = (shared)=>{
163
- const { testingLibrary } = ConfigFile.backend;
164
146
  const servicesFolder = shared.subitem([
165
147
  'infrastructure',
166
148
  'services'
167
149
  ]);
168
150
  servicesFolder.createFile('in-memory-db-infrastructure-service.ts', inMemoryDbService);
169
- if (testingLibrary) servicesFolder.createFile('in-memory-db-infrastructure-service.spec.ts', inMemoryDbSpec(testingLibrary, in_memory_db_withWiring()));
170
151
  if (in_memory_db_withWiring()) shared.subitem([
171
152
  'wiring',
172
153
  'infrastructure-services'
@@ -228,9 +209,6 @@ const wireInMemoryDb = (consumerWireFile, implementationName)=>{
228
209
  in_memory_db_wireName
229
210
  ]));
230
211
  };
231
- const passInMemoryDb = (specFile, implementationName)=>{
232
- specFile.update(addImport(specFile.data, `import { ${in_memory_db_className} } from '${relativeImport(specFile.path, serviceFile().path)}'`).replace(`new ${implementationName}()`, `new ${implementationName}(new ${in_memory_db_className}())`));
233
- };
234
212
  const addInMemoryDb = ()=>{
235
213
  const config = ConfigFile.Instance.data;
236
214
  if (!ConfigFile.backend.withInMemoryDb) ConfigFile.update({
@@ -3500,29 +3478,6 @@ describe('${aggregateNaming.withSpaces}', () => {
3500
3478
  labels: []
3501
3479
  };
3502
3480
  for (const implementation of implementationTypes)createImplementation(boundedContextFolder, repository, new UnknownFormatNaming(implementation).fileName);
3503
- if (scaffoldUnitTests) {
3504
- const implementationNaming = new UnknownFormatNaming(infrastructureImplementationType);
3505
- const specFile = aggregatesFolder.createFile(`${aggregateNaming.fileName}-repository.spec.ts`, `
3506
- import { describe, test, expect, beforeEach } from '${ConfigFile.backend.testingLibrary}'
3507
- ${ConfigFile.backend.domainFirstPackages.includes('@domain-first/wire') ? `import { wire${aggregateNaming.ClassName}Repository } from '../../../wiring/repositories/wire-${aggregateNaming.fileName}-repository'
3508
- import type { ${aggregateNaming.ClassName}Repository } from './${aggregateNaming.fileName}-repository'` : `import { ${implementationNaming.ClassName}${aggregateNaming.ClassName}Repository } from '../../../infrastructure/repositories/${implementationNaming.fileName}/${implementationNaming.fileName}-${aggregateNaming.fileName}-repository'
3509
-
3510
- type ${aggregateNaming.ClassName}Repository = ${implementationNaming.ClassName}${aggregateNaming.ClassName}Repository`}
3511
-
3512
- let ${aggregateNaming.variableName}Repository: ${aggregateNaming.ClassName}Repository
3513
-
3514
- beforeEach(() => {
3515
- ${aggregateNaming.variableName}Repository = ${ConfigFile.backend.domainFirstPackages.includes('@domain-first/wire') ? `wire${aggregateNaming.ClassName}Repository()` : `new ${implementationNaming.ClassName}${aggregateNaming.ClassName}Repository()`}
3516
- })
3517
-
3518
- describe('${aggregateNaming.withSpaces} repository', () => {
3519
- test('can be ${ConfigFile.backend.domainFirstPackages.includes('@domain-first/wire') ? 'wired' : 'created via constructor'}', () => {
3520
- expect(${aggregateNaming.variableName}Repository).toBeDefined()
3521
- })
3522
- })
3523
- `.trim());
3524
- if (!ConfigFile.backend.domainFirstPackages.includes('@domain-first/wire') && usesInMemoryDb(infrastructureImplementationType)) passInMemoryDb(specFile, `${implementationNaming.ClassName}${aggregateNaming.ClassName}Repository`);
3525
- }
3526
3481
  if (ConfigFile.backend.domainFirstPackages.includes('@domain-first/wire')) {
3527
3482
  const implementationNaming = new UnknownFormatNaming(infrastructureImplementationType);
3528
3483
  const testImplementationNaming = new UnknownFormatNaming(testImplementationType);
@@ -3548,7 +3503,6 @@ const scaffoldNewApplicationPort = async (boundedContextFolder)=>{
3548
3503
  message: 'Name: '
3549
3504
  });
3550
3505
  const naming = new UnknownFormatNaming(name);
3551
- const scaffoldUnitTests = Boolean(ConfigFile.backend.testingLibrary);
3552
3506
  const wiringFolder = boundedContextFolder.subitem([
3553
3507
  'wiring',
3554
3508
  'application-ports'
@@ -3588,28 +3542,6 @@ export abstract class ${naming.ClassName} {
3588
3542
  ownerPath: boundedContextFolder.path,
3589
3543
  labels: []
3590
3544
  }, implementation);
3591
- if (scaffoldUnitTests) {
3592
- const implementationNaming = new UnknownFormatNaming(implementationType);
3593
- applicationPortsFolder.createFile(`${naming.fileName}.spec.ts`, `
3594
- import { describe, test, expect, beforeEach } from '${ConfigFile.backend.testingLibrary}'
3595
- ${ConfigFile.backend.domainFirstPackages.includes('@domain-first/wire') ? `import { type ${naming.ClassName} } from './${naming.fileName}'
3596
- import { wire${naming.ClassName} } from '../../wiring/application-ports/wire-${naming.fileName}'` : `import { ${implementationNaming.ClassName}${naming.ClassName} } from '../../infrastructure/application-adapters/${implementationNaming.fileName}/${implementationNaming.fileName}-${naming.fileName}'
3597
-
3598
- type ${naming.ClassName} = ${implementationNaming.ClassName}${naming.ClassName}`}
3599
-
3600
- let ${naming.variableName}: ${naming.ClassName}
3601
-
3602
- beforeEach(() => {
3603
- ${naming.variableName} = ${ConfigFile.backend.domainFirstPackages.includes('@domain-first/wire') ? `wire${naming.ClassName}()` : `new ${implementationNaming.ClassName}${naming.ClassName}()`}
3604
- })
3605
-
3606
- describe('${naming.withSpaces}', () => {
3607
- test('can be ${ConfigFile.backend.domainFirstPackages.includes('@domain-first/wire') ? 'wired' : 'created via constructor'}', () => {
3608
- expect(${naming.variableName}).toBeDefined()
3609
- })
3610
- })
3611
- `.trim());
3612
- }
3613
3545
  if (ConfigFile.backend.domainFirstPackages.includes('@domain-first/wire')) {
3614
3546
  const wireFile = wiringFolder.createFile(`wire-${naming.fileName}.ts`, `
3615
3547
  import { wireClass } from '@domain-first/wire'
@@ -3705,9 +3637,7 @@ const scaffoldNewCommand = async (boundedContextFolder)=>{
3705
3637
  key: 'name',
3706
3638
  message: 'Name: '
3707
3639
  });
3708
- const scaffoldUnitTests = Boolean(ConfigFile.backend.testingLibrary);
3709
3640
  const naming = new UnknownFormatNaming(commandName);
3710
- const withWiring = ConfigFile.backend.domainFirstPackages.includes('@domain-first/wire');
3711
3641
  const { label: implementationType } = await promptImplementationType('Command infrastructure implementation type:', 'commands');
3712
3642
  let addTestImplementation = false;
3713
3643
  let testImplementationType = '';
@@ -3745,29 +3675,6 @@ export abstract class ${naming.ClassName}Command {
3745
3675
  export abstract class ${naming.ClassName}Command {
3746
3676
 
3747
3677
  }`.trim());
3748
- if (scaffoldUnitTests) {
3749
- const implementationNaming = new UnknownFormatNaming(implementationType);
3750
- const specFile = commandsFolder.createFile(`${naming.fileName}-command.spec.ts`, `
3751
- import { describe, test, expect, beforeEach } from '${ConfigFile.backend.testingLibrary}'
3752
- ${withWiring ? `import { type ${naming.ClassName}Command } from './${naming.fileName}-command'
3753
- import { wire${naming.ClassName}Command } from '../../wiring/commands/wire-${naming.fileName}-command'` : `import { ${implementationNaming.ClassName}${naming.ClassName}Command } from '../../infrastructure/commands/${implementationNaming.fileName}/${implementationNaming.fileName}-${naming.fileName}-command'
3754
-
3755
- type ${naming.ClassName}Command = ${implementationNaming.ClassName}${naming.ClassName}Command`}
3756
-
3757
- let ${naming.variableName}Command: ${naming.ClassName}Command
3758
-
3759
- beforeEach(() => {
3760
- ${naming.variableName}Command = ${withWiring ? `wire${naming.ClassName}Command()` : `new ${implementationNaming.ClassName}${naming.ClassName}Command()`}
3761
- })
3762
-
3763
- describe('${naming.withSpaces} command', () => {
3764
- test('can be ${withWiring ? 'wired' : 'created via constructor'}', () => {
3765
- expect(${naming.variableName}Command).toBeDefined()
3766
- })
3767
- })
3768
- `.trim());
3769
- if (!withWiring && usesInMemoryDb(implementationType)) passInMemoryDb(specFile, `${implementationNaming.ClassName}${naming.ClassName}Command`);
3770
- }
3771
3678
  if (ConfigFile.backend.domainFirstPackages.includes('@domain-first/wire')) {
3772
3679
  const implementationNaming = new UnknownFormatNaming(implementationType);
3773
3680
  const testImplementationNaming = new UnknownFormatNaming(testImplementationType);
@@ -4258,16 +4165,6 @@ const scaffoldNewInfrastructureHelper = async (ownerFolder)=>{
4258
4165
  ...name.folders
4259
4166
  ]);
4260
4167
  folder.createFile(`${fileName}.ts`, `export const ${naming.variableName} = () => {}`);
4261
- if (ConfigFile.backend.testingLibrary) folder.createFile(`${fileName}.spec.ts`, `
4262
- import { describe, test, expect } from '${ConfigFile.backend.testingLibrary}'
4263
- import { ${naming.variableName} } from './${fileName}'
4264
-
4265
- describe('${naming.withSpaces}', () => {
4266
- test('is defined', () => {
4267
- expect(${naming.variableName}).toBeDefined()
4268
- })
4269
- })
4270
- `.trim());
4271
4168
  };
4272
4169
  const scaffoldNewInfrastructureService = async (boundedContextFolder)=>{
4273
4170
  const name = await interaction_input({
@@ -4275,7 +4172,6 @@ const scaffoldNewInfrastructureService = async (boundedContextFolder)=>{
4275
4172
  message: 'Name: '
4276
4173
  });
4277
4174
  const naming = new UnknownFormatNaming(name);
4278
- const scaffoldUnitTests = Boolean(ConfigFile.backend.testingLibrary);
4279
4175
  const withWiring = ConfigFile.backend.domainFirstPackages.includes('@domain-first/wire');
4280
4176
  const wiringFolder = boundedContextFolder.subitem([
4281
4177
  'wiring',
@@ -4290,23 +4186,6 @@ export class ${naming.ClassName}InfrastructureService {
4290
4186
 
4291
4187
  }
4292
4188
  `.trim());
4293
- if (scaffoldUnitTests) infrastructureServicesFolder.createFile(`${naming.fileName}-infrastructure-service.spec.ts`, `
4294
- import { describe, test, expect, beforeEach } from '${ConfigFile.backend.testingLibrary}'
4295
- ${withWiring ? `import { type ${naming.ClassName}InfrastructureService } from './${naming.fileName}-infrastructure-service'
4296
- import { wire${naming.ClassName}InfrastructureService } from '../../wiring/infrastructure-services/wire-${naming.fileName}-infrastructure-service'` : `import { ${naming.ClassName}InfrastructureService } from './${naming.fileName}-infrastructure-service'`}
4297
-
4298
- let ${naming.variableName}InfrastructureService: ${naming.ClassName}InfrastructureService
4299
-
4300
- beforeEach(() => {
4301
- ${naming.variableName}InfrastructureService = ${withWiring ? `wire${naming.ClassName}InfrastructureService()` : `new ${naming.ClassName}InfrastructureService()`}
4302
- })
4303
-
4304
- describe('${naming.withSpaces}', () => {
4305
- test('can be ${withWiring ? 'wired' : 'created'}', () => {
4306
- expect(${naming.variableName}InfrastructureService).toBeDefined()
4307
- })
4308
- })
4309
- `.trim());
4310
4189
  if (withWiring) {
4311
4190
  const wireFile = wiringFolder.createFile(`wire-${naming.fileName}-infrastructure-service.ts`, `
4312
4191
  import { wireClass } from '@domain-first/wire'
@@ -4329,9 +4208,7 @@ const scaffoldNewQuery = async (boundedContextFolder)=>{
4329
4208
  key: 'name',
4330
4209
  message: 'Name: '
4331
4210
  });
4332
- const scaffoldUnitTests = Boolean(ConfigFile.backend.testingLibrary);
4333
4211
  const naming = new UnknownFormatNaming(queryName);
4334
- const withWiring = ConfigFile.backend.domainFirstPackages.includes('@domain-first/wire');
4335
4212
  const { label: implementationType } = await promptImplementationType('Query infrastructure implementation type:', 'queries');
4336
4213
  let addTestImplementation = false;
4337
4214
  let testImplementationType = '';
@@ -4369,29 +4246,6 @@ export abstract class ${naming.ClassName}Query {
4369
4246
  export abstract class ${naming.ClassName}Query {
4370
4247
 
4371
4248
  }`.trim());
4372
- if (scaffoldUnitTests) {
4373
- const implementationNaming = new UnknownFormatNaming(implementationType);
4374
- const specFile = queriesFolder.createFile(`${naming.fileName}-query.spec.ts`, `
4375
- import { describe, test, expect, beforeEach } from '${ConfigFile.backend.testingLibrary}'
4376
- ${withWiring ? `import { type ${naming.ClassName}Query } from './${naming.fileName}-query'
4377
- import { wire${naming.ClassName}Query } from '../../wiring/queries/wire-${naming.fileName}-query'` : `import { ${implementationNaming.ClassName}${naming.ClassName}Query } from '../../infrastructure/queries/${implementationNaming.fileName}/${implementationNaming.fileName}-${naming.fileName}-query'
4378
-
4379
- type ${naming.ClassName}Query = ${implementationNaming.ClassName}${naming.ClassName}Query`}
4380
-
4381
- let ${naming.variableName}Query: ${naming.ClassName}Query
4382
-
4383
- beforeEach(() => {
4384
- ${naming.variableName}Query = ${withWiring ? `wire${naming.ClassName}Query()` : `new ${implementationNaming.ClassName}${naming.ClassName}Query()`}
4385
- })
4386
-
4387
- describe('${naming.withSpaces} query', () => {
4388
- test('can be ${withWiring ? 'wired' : 'created via constructor'}', () => {
4389
- expect(${naming.variableName}Query).toBeDefined()
4390
- })
4391
- })
4392
- `.trim());
4393
- if (!withWiring && usesInMemoryDb(implementationType)) passInMemoryDb(specFile, `${implementationNaming.ClassName}${naming.ClassName}Query`);
4394
- }
4395
4249
  if (ConfigFile.backend.domainFirstPackages.includes('@domain-first/wire')) {
4396
4250
  const implementationNaming = new UnknownFormatNaming(implementationType);
4397
4251
  const testImplementationNaming = new UnknownFormatNaming(testImplementationType);
@@ -2,7 +2,7 @@ import { File, Folder } from './file-system';
2
2
  import { UnknownFormatNaming } from './unknown-format-naming';
3
3
  import { type WiredModule } from './wiring';
4
4
  /**
5
- * The shared in-memory DB with its spec and wire, as the config says.
5
+ * The shared in-memory DB with its wire, as the config says.
6
6
  */
7
7
  export declare const scaffoldInMemoryDb: (shared: Folder) => void;
8
8
  /**
@@ -51,8 +51,3 @@ export declare const injectInMemoryDb: (classFile: File, implementationName: str
51
51
  * Passes the in-memory DB wire to the implementation's `wireClass`.
52
52
  */
53
53
  export declare const wireInMemoryDb: (consumerWireFile: File, implementationName: string) => void;
54
- /**
55
- * A spec without wiring builds the implementation itself, so it has to
56
- * pass the in-memory DB.
57
- */
58
- export declare const passInMemoryDb: (specFile: File, implementationName: string) => void;
package/dist/index.cjs CHANGED
@@ -1023,23 +1023,6 @@ export const wireInMemoryDbInfrastructureService = wireClass(
1023
1023
  []
1024
1024
  );
1025
1025
  `;
1026
- const inMemoryDbSpec = (testingLibrary, withWiring)=>`
1027
- import { describe, test, expect, beforeEach } from '${testingLibrary}'
1028
- ${withWiring ? `import { type InMemoryDbInfrastructureService } from './in-memory-db-infrastructure-service'
1029
- import { wireInMemoryDbInfrastructureService } from '../../wiring/infrastructure-services/wire-in-memory-db-infrastructure-service'` : "import { InMemoryDbInfrastructureService } from './in-memory-db-infrastructure-service'"}
1030
-
1031
- let inMemoryDbInfrastructureService: InMemoryDbInfrastructureService
1032
-
1033
- beforeEach(() => {
1034
- inMemoryDbInfrastructureService = ${withWiring ? 'wireInMemoryDbInfrastructureService()' : 'new InMemoryDbInfrastructureService()'}
1035
- })
1036
-
1037
- describe('in memory db', () => {
1038
- test('can be ${withWiring ? 'wired' : 'created'}', () => {
1039
- expect(inMemoryDbInfrastructureService).toBeDefined()
1040
- })
1041
- })
1042
- `.trim();
1043
1026
  const in_memory_db_withWiring = ()=>config_file_ConfigFile.backend.domainFirstPackages.includes('@domain-first/wire');
1044
1027
  const in_memory_db_sharedFolder = ()=>new file_system_Folder(new project_root_ProjectRoot().path).subitem([
1045
1028
  config_file_ConfigFile.Instance.data.project.rootFolder,
@@ -1056,13 +1039,11 @@ const in_memory_db_wireFile = ()=>new file_system_File(in_memory_db_sharedFolder
1056
1039
  'wire-in-memory-db-infrastructure-service.ts'
1057
1040
  ]);
1058
1041
  const in_memory_db_scaffoldInMemoryDb = (shared)=>{
1059
- const { testingLibrary } = config_file_ConfigFile.backend;
1060
1042
  const servicesFolder = shared.subitem([
1061
1043
  'infrastructure',
1062
1044
  'services'
1063
1045
  ]);
1064
1046
  servicesFolder.createFile('in-memory-db-infrastructure-service.ts', inMemoryDbService);
1065
- if (testingLibrary) servicesFolder.createFile('in-memory-db-infrastructure-service.spec.ts', inMemoryDbSpec(testingLibrary, in_memory_db_withWiring()));
1066
1047
  if (in_memory_db_withWiring()) shared.subitem([
1067
1048
  'wiring',
1068
1049
  'infrastructure-services'
@@ -1124,9 +1105,6 @@ const wireInMemoryDb = (consumerWireFile, implementationName)=>{
1124
1105
  in_memory_db_wireName
1125
1106
  ]));
1126
1107
  };
1127
- const passInMemoryDb = (specFile, implementationName)=>{
1128
- specFile.update(addImport(specFile.data, `import { ${in_memory_db_className} } from '${relativeImport(specFile.path, serviceFile().path)}'`).replace(`new ${implementationName}()`, `new ${implementationName}(new ${in_memory_db_className}())`));
1129
- };
1130
1108
  const addInMemoryDb = ()=>{
1131
1109
  const config = config_file_ConfigFile.Instance.data;
1132
1110
  if (!config_file_ConfigFile.backend.withInMemoryDb) config_file_ConfigFile.update({
@@ -4713,29 +4691,6 @@ describe('${aggregateNaming.withSpaces}', () => {
4713
4691
  labels: []
4714
4692
  };
4715
4693
  for (const implementation of implementationTypes)createImplementation(boundedContextFolder, repository, new UnknownFormatNaming(implementation).fileName);
4716
- if (scaffoldUnitTests) {
4717
- const implementationNaming = new UnknownFormatNaming(infrastructureImplementationType);
4718
- const specFile = aggregatesFolder.createFile(`${aggregateNaming.fileName}-repository.spec.ts`, `
4719
- import { describe, test, expect, beforeEach } from '${config_file_ConfigFile.backend.testingLibrary}'
4720
- ${config_file_ConfigFile.backend.domainFirstPackages.includes('@domain-first/wire') ? `import { wire${aggregateNaming.ClassName}Repository } from '../../../wiring/repositories/wire-${aggregateNaming.fileName}-repository'
4721
- import type { ${aggregateNaming.ClassName}Repository } from './${aggregateNaming.fileName}-repository'` : `import { ${implementationNaming.ClassName}${aggregateNaming.ClassName}Repository } from '../../../infrastructure/repositories/${implementationNaming.fileName}/${implementationNaming.fileName}-${aggregateNaming.fileName}-repository'
4722
-
4723
- type ${aggregateNaming.ClassName}Repository = ${implementationNaming.ClassName}${aggregateNaming.ClassName}Repository`}
4724
-
4725
- let ${aggregateNaming.variableName}Repository: ${aggregateNaming.ClassName}Repository
4726
-
4727
- beforeEach(() => {
4728
- ${aggregateNaming.variableName}Repository = ${config_file_ConfigFile.backend.domainFirstPackages.includes('@domain-first/wire') ? `wire${aggregateNaming.ClassName}Repository()` : `new ${implementationNaming.ClassName}${aggregateNaming.ClassName}Repository()`}
4729
- })
4730
-
4731
- describe('${aggregateNaming.withSpaces} repository', () => {
4732
- test('can be ${config_file_ConfigFile.backend.domainFirstPackages.includes('@domain-first/wire') ? 'wired' : 'created via constructor'}', () => {
4733
- expect(${aggregateNaming.variableName}Repository).toBeDefined()
4734
- })
4735
- })
4736
- `.trim());
4737
- if (!config_file_ConfigFile.backend.domainFirstPackages.includes('@domain-first/wire') && usesInMemoryDb(infrastructureImplementationType)) passInMemoryDb(specFile, `${implementationNaming.ClassName}${aggregateNaming.ClassName}Repository`);
4738
- }
4739
4694
  if (config_file_ConfigFile.backend.domainFirstPackages.includes('@domain-first/wire')) {
4740
4695
  const implementationNaming = new UnknownFormatNaming(infrastructureImplementationType);
4741
4696
  const testImplementationNaming = new UnknownFormatNaming(testImplementationType);
@@ -4761,7 +4716,6 @@ const scaffoldNewApplicationPort = async (boundedContextFolder)=>{
4761
4716
  message: 'Name: '
4762
4717
  });
4763
4718
  const naming = new UnknownFormatNaming(name);
4764
- const scaffoldUnitTests = Boolean(config_file_ConfigFile.backend.testingLibrary);
4765
4719
  const wiringFolder = boundedContextFolder.subitem([
4766
4720
  'wiring',
4767
4721
  'application-ports'
@@ -4801,28 +4755,6 @@ export abstract class ${naming.ClassName} {
4801
4755
  ownerPath: boundedContextFolder.path,
4802
4756
  labels: []
4803
4757
  }, implementation);
4804
- if (scaffoldUnitTests) {
4805
- const implementationNaming = new UnknownFormatNaming(implementationType);
4806
- applicationPortsFolder.createFile(`${naming.fileName}.spec.ts`, `
4807
- import { describe, test, expect, beforeEach } from '${config_file_ConfigFile.backend.testingLibrary}'
4808
- ${config_file_ConfigFile.backend.domainFirstPackages.includes('@domain-first/wire') ? `import { type ${naming.ClassName} } from './${naming.fileName}'
4809
- import { wire${naming.ClassName} } from '../../wiring/application-ports/wire-${naming.fileName}'` : `import { ${implementationNaming.ClassName}${naming.ClassName} } from '../../infrastructure/application-adapters/${implementationNaming.fileName}/${implementationNaming.fileName}-${naming.fileName}'
4810
-
4811
- type ${naming.ClassName} = ${implementationNaming.ClassName}${naming.ClassName}`}
4812
-
4813
- let ${naming.variableName}: ${naming.ClassName}
4814
-
4815
- beforeEach(() => {
4816
- ${naming.variableName} = ${config_file_ConfigFile.backend.domainFirstPackages.includes('@domain-first/wire') ? `wire${naming.ClassName}()` : `new ${implementationNaming.ClassName}${naming.ClassName}()`}
4817
- })
4818
-
4819
- describe('${naming.withSpaces}', () => {
4820
- test('can be ${config_file_ConfigFile.backend.domainFirstPackages.includes('@domain-first/wire') ? 'wired' : 'created via constructor'}', () => {
4821
- expect(${naming.variableName}).toBeDefined()
4822
- })
4823
- })
4824
- `.trim());
4825
- }
4826
4758
  if (config_file_ConfigFile.backend.domainFirstPackages.includes('@domain-first/wire')) {
4827
4759
  const wireFile = wiringFolder.createFile(`wire-${naming.fileName}.ts`, `
4828
4760
  import { wireClass } from '@domain-first/wire'
@@ -4918,9 +4850,7 @@ const scaffoldNewCommand = async (boundedContextFolder)=>{
4918
4850
  key: 'name',
4919
4851
  message: 'Name: '
4920
4852
  });
4921
- const scaffoldUnitTests = Boolean(config_file_ConfigFile.backend.testingLibrary);
4922
4853
  const naming = new UnknownFormatNaming(commandName);
4923
- const withWiring = config_file_ConfigFile.backend.domainFirstPackages.includes('@domain-first/wire');
4924
4854
  const { label: implementationType } = await promptImplementationType('Command infrastructure implementation type:', 'commands');
4925
4855
  let addTestImplementation = false;
4926
4856
  let testImplementationType = '';
@@ -4958,29 +4888,6 @@ export abstract class ${naming.ClassName}Command {
4958
4888
  export abstract class ${naming.ClassName}Command {
4959
4889
 
4960
4890
  }`.trim());
4961
- if (scaffoldUnitTests) {
4962
- const implementationNaming = new UnknownFormatNaming(implementationType);
4963
- const specFile = commandsFolder.createFile(`${naming.fileName}-command.spec.ts`, `
4964
- import { describe, test, expect, beforeEach } from '${config_file_ConfigFile.backend.testingLibrary}'
4965
- ${withWiring ? `import { type ${naming.ClassName}Command } from './${naming.fileName}-command'
4966
- import { wire${naming.ClassName}Command } from '../../wiring/commands/wire-${naming.fileName}-command'` : `import { ${implementationNaming.ClassName}${naming.ClassName}Command } from '../../infrastructure/commands/${implementationNaming.fileName}/${implementationNaming.fileName}-${naming.fileName}-command'
4967
-
4968
- type ${naming.ClassName}Command = ${implementationNaming.ClassName}${naming.ClassName}Command`}
4969
-
4970
- let ${naming.variableName}Command: ${naming.ClassName}Command
4971
-
4972
- beforeEach(() => {
4973
- ${naming.variableName}Command = ${withWiring ? `wire${naming.ClassName}Command()` : `new ${implementationNaming.ClassName}${naming.ClassName}Command()`}
4974
- })
4975
-
4976
- describe('${naming.withSpaces} command', () => {
4977
- test('can be ${withWiring ? 'wired' : 'created via constructor'}', () => {
4978
- expect(${naming.variableName}Command).toBeDefined()
4979
- })
4980
- })
4981
- `.trim());
4982
- if (!withWiring && usesInMemoryDb(implementationType)) passInMemoryDb(specFile, `${implementationNaming.ClassName}${naming.ClassName}Command`);
4983
- }
4984
4891
  if (config_file_ConfigFile.backend.domainFirstPackages.includes('@domain-first/wire')) {
4985
4892
  const implementationNaming = new UnknownFormatNaming(implementationType);
4986
4893
  const testImplementationNaming = new UnknownFormatNaming(testImplementationType);
@@ -5471,16 +5378,6 @@ const scaffoldNewInfrastructureHelper = async (ownerFolder)=>{
5471
5378
  ...name.folders
5472
5379
  ]);
5473
5380
  folder.createFile(`${fileName}.ts`, `export const ${naming.variableName} = () => {}`);
5474
- if (config_file_ConfigFile.backend.testingLibrary) folder.createFile(`${fileName}.spec.ts`, `
5475
- import { describe, test, expect } from '${config_file_ConfigFile.backend.testingLibrary}'
5476
- import { ${naming.variableName} } from './${fileName}'
5477
-
5478
- describe('${naming.withSpaces}', () => {
5479
- test('is defined', () => {
5480
- expect(${naming.variableName}).toBeDefined()
5481
- })
5482
- })
5483
- `.trim());
5484
5381
  };
5485
5382
  const scaffoldNewInfrastructureService = async (boundedContextFolder)=>{
5486
5383
  const name = await interaction_input({
@@ -5488,7 +5385,6 @@ const scaffoldNewInfrastructureService = async (boundedContextFolder)=>{
5488
5385
  message: 'Name: '
5489
5386
  });
5490
5387
  const naming = new UnknownFormatNaming(name);
5491
- const scaffoldUnitTests = Boolean(config_file_ConfigFile.backend.testingLibrary);
5492
5388
  const withWiring = config_file_ConfigFile.backend.domainFirstPackages.includes('@domain-first/wire');
5493
5389
  const wiringFolder = boundedContextFolder.subitem([
5494
5390
  'wiring',
@@ -5503,23 +5399,6 @@ export class ${naming.ClassName}InfrastructureService {
5503
5399
 
5504
5400
  }
5505
5401
  `.trim());
5506
- if (scaffoldUnitTests) infrastructureServicesFolder.createFile(`${naming.fileName}-infrastructure-service.spec.ts`, `
5507
- import { describe, test, expect, beforeEach } from '${config_file_ConfigFile.backend.testingLibrary}'
5508
- ${withWiring ? `import { type ${naming.ClassName}InfrastructureService } from './${naming.fileName}-infrastructure-service'
5509
- import { wire${naming.ClassName}InfrastructureService } from '../../wiring/infrastructure-services/wire-${naming.fileName}-infrastructure-service'` : `import { ${naming.ClassName}InfrastructureService } from './${naming.fileName}-infrastructure-service'`}
5510
-
5511
- let ${naming.variableName}InfrastructureService: ${naming.ClassName}InfrastructureService
5512
-
5513
- beforeEach(() => {
5514
- ${naming.variableName}InfrastructureService = ${withWiring ? `wire${naming.ClassName}InfrastructureService()` : `new ${naming.ClassName}InfrastructureService()`}
5515
- })
5516
-
5517
- describe('${naming.withSpaces}', () => {
5518
- test('can be ${withWiring ? 'wired' : 'created'}', () => {
5519
- expect(${naming.variableName}InfrastructureService).toBeDefined()
5520
- })
5521
- })
5522
- `.trim());
5523
5402
  if (withWiring) {
5524
5403
  const wireFile = wiringFolder.createFile(`wire-${naming.fileName}-infrastructure-service.ts`, `
5525
5404
  import { wireClass } from '@domain-first/wire'
@@ -5542,9 +5421,7 @@ const scaffoldNewQuery = async (boundedContextFolder)=>{
5542
5421
  key: 'name',
5543
5422
  message: 'Name: '
5544
5423
  });
5545
- const scaffoldUnitTests = Boolean(config_file_ConfigFile.backend.testingLibrary);
5546
5424
  const naming = new UnknownFormatNaming(queryName);
5547
- const withWiring = config_file_ConfigFile.backend.domainFirstPackages.includes('@domain-first/wire');
5548
5425
  const { label: implementationType } = await promptImplementationType('Query infrastructure implementation type:', 'queries');
5549
5426
  let addTestImplementation = false;
5550
5427
  let testImplementationType = '';
@@ -5582,29 +5459,6 @@ export abstract class ${naming.ClassName}Query {
5582
5459
  export abstract class ${naming.ClassName}Query {
5583
5460
 
5584
5461
  }`.trim());
5585
- if (scaffoldUnitTests) {
5586
- const implementationNaming = new UnknownFormatNaming(implementationType);
5587
- const specFile = queriesFolder.createFile(`${naming.fileName}-query.spec.ts`, `
5588
- import { describe, test, expect, beforeEach } from '${config_file_ConfigFile.backend.testingLibrary}'
5589
- ${withWiring ? `import { type ${naming.ClassName}Query } from './${naming.fileName}-query'
5590
- import { wire${naming.ClassName}Query } from '../../wiring/queries/wire-${naming.fileName}-query'` : `import { ${implementationNaming.ClassName}${naming.ClassName}Query } from '../../infrastructure/queries/${implementationNaming.fileName}/${implementationNaming.fileName}-${naming.fileName}-query'
5591
-
5592
- type ${naming.ClassName}Query = ${implementationNaming.ClassName}${naming.ClassName}Query`}
5593
-
5594
- let ${naming.variableName}Query: ${naming.ClassName}Query
5595
-
5596
- beforeEach(() => {
5597
- ${naming.variableName}Query = ${withWiring ? `wire${naming.ClassName}Query()` : `new ${implementationNaming.ClassName}${naming.ClassName}Query()`}
5598
- })
5599
-
5600
- describe('${naming.withSpaces} query', () => {
5601
- test('can be ${withWiring ? 'wired' : 'created via constructor'}', () => {
5602
- expect(${naming.variableName}Query).toBeDefined()
5603
- })
5604
- })
5605
- `.trim());
5606
- if (!withWiring && usesInMemoryDb(implementationType)) passInMemoryDb(specFile, `${implementationNaming.ClassName}${naming.ClassName}Query`);
5607
- }
5608
5462
  if (config_file_ConfigFile.backend.domainFirstPackages.includes('@domain-first/wire')) {
5609
5463
  const implementationNaming = new UnknownFormatNaming(implementationType);
5610
5464
  const testImplementationNaming = new UnknownFormatNaming(testImplementationType);
package/dist/init.cjs CHANGED
@@ -760,32 +760,13 @@ export const wireInMemoryDbInfrastructureService = wireClass(
760
760
  []
761
761
  );
762
762
  `;
763
- const inMemoryDbSpec = (testingLibrary, withWiring)=>`
764
- import { describe, test, expect, beforeEach } from '${testingLibrary}'
765
- ${withWiring ? `import { type InMemoryDbInfrastructureService } from './in-memory-db-infrastructure-service'
766
- import { wireInMemoryDbInfrastructureService } from '../../wiring/infrastructure-services/wire-in-memory-db-infrastructure-service'` : "import { InMemoryDbInfrastructureService } from './in-memory-db-infrastructure-service'"}
767
-
768
- let inMemoryDbInfrastructureService: InMemoryDbInfrastructureService
769
-
770
- beforeEach(() => {
771
- inMemoryDbInfrastructureService = ${withWiring ? 'wireInMemoryDbInfrastructureService()' : 'new InMemoryDbInfrastructureService()'}
772
- })
773
-
774
- describe('in memory db', () => {
775
- test('can be ${withWiring ? 'wired' : 'created'}', () => {
776
- expect(inMemoryDbInfrastructureService).toBeDefined()
777
- })
778
- })
779
- `.trim();
780
763
  const in_memory_db_withWiring = ()=>config_file_ConfigFile.backend.domainFirstPackages.includes('@domain-first/wire');
781
764
  const in_memory_db_scaffoldInMemoryDb = (shared)=>{
782
- const { testingLibrary } = config_file_ConfigFile.backend;
783
765
  const servicesFolder = shared.subitem([
784
766
  'infrastructure',
785
767
  'services'
786
768
  ]);
787
769
  servicesFolder.createFile('in-memory-db-infrastructure-service.ts', inMemoryDbService);
788
- if (testingLibrary) servicesFolder.createFile('in-memory-db-infrastructure-service.spec.ts', inMemoryDbSpec(testingLibrary, in_memory_db_withWiring()));
789
770
  if (in_memory_db_withWiring()) shared.subitem([
790
771
  'wiring',
791
772
  'infrastructure-services'
@@ -1022,23 +1022,6 @@ export const wireInMemoryDbInfrastructureService = wireClass(
1022
1022
  []
1023
1023
  );
1024
1024
  `;
1025
- const inMemoryDbSpec = (testingLibrary, withWiring)=>`
1026
- import { describe, test, expect, beforeEach } from '${testingLibrary}'
1027
- ${withWiring ? `import { type InMemoryDbInfrastructureService } from './in-memory-db-infrastructure-service'
1028
- import { wireInMemoryDbInfrastructureService } from '../../wiring/infrastructure-services/wire-in-memory-db-infrastructure-service'` : "import { InMemoryDbInfrastructureService } from './in-memory-db-infrastructure-service'"}
1029
-
1030
- let inMemoryDbInfrastructureService: InMemoryDbInfrastructureService
1031
-
1032
- beforeEach(() => {
1033
- inMemoryDbInfrastructureService = ${withWiring ? 'wireInMemoryDbInfrastructureService()' : 'new InMemoryDbInfrastructureService()'}
1034
- })
1035
-
1036
- describe('in memory db', () => {
1037
- test('can be ${withWiring ? 'wired' : 'created'}', () => {
1038
- expect(inMemoryDbInfrastructureService).toBeDefined()
1039
- })
1040
- })
1041
- `.trim();
1042
1025
  const in_memory_db_withWiring = ()=>config_file_ConfigFile.backend.domainFirstPackages.includes('@domain-first/wire');
1043
1026
  const in_memory_db_sharedFolder = ()=>new file_system_Folder(new project_root_ProjectRoot().path).subitem([
1044
1027
  config_file_ConfigFile.Instance.data.project.rootFolder,
@@ -1055,13 +1038,11 @@ const in_memory_db_wireFile = ()=>new file_system_File(in_memory_db_sharedFolder
1055
1038
  'wire-in-memory-db-infrastructure-service.ts'
1056
1039
  ]);
1057
1040
  const in_memory_db_scaffoldInMemoryDb = (shared)=>{
1058
- const { testingLibrary } = config_file_ConfigFile.backend;
1059
1041
  const servicesFolder = shared.subitem([
1060
1042
  'infrastructure',
1061
1043
  'services'
1062
1044
  ]);
1063
1045
  servicesFolder.createFile('in-memory-db-infrastructure-service.ts', inMemoryDbService);
1064
- if (testingLibrary) servicesFolder.createFile('in-memory-db-infrastructure-service.spec.ts', inMemoryDbSpec(testingLibrary, in_memory_db_withWiring()));
1065
1046
  if (in_memory_db_withWiring()) shared.subitem([
1066
1047
  'wiring',
1067
1048
  'infrastructure-services'
@@ -1123,9 +1104,6 @@ const wireInMemoryDb = (consumerWireFile, implementationName)=>{
1123
1104
  in_memory_db_wireName
1124
1105
  ]));
1125
1106
  };
1126
- const passInMemoryDb = (specFile, implementationName)=>{
1127
- specFile.update(addImport(specFile.data, `import { ${in_memory_db_className} } from '${relativeImport(specFile.path, serviceFile().path)}'`).replace(`new ${implementationName}()`, `new ${implementationName}(new ${in_memory_db_className}())`));
1128
- };
1129
1107
  const addInMemoryDb = ()=>{
1130
1108
  const config = config_file_ConfigFile.Instance.data;
1131
1109
  if (!config_file_ConfigFile.backend.withInMemoryDb) config_file_ConfigFile.update({
@@ -4713,29 +4691,6 @@ describe('${aggregateNaming.withSpaces}', () => {
4713
4691
  labels: []
4714
4692
  };
4715
4693
  for (const implementation of implementationTypes)createImplementation(boundedContextFolder, repository, new UnknownFormatNaming(implementation).fileName);
4716
- if (scaffoldUnitTests) {
4717
- const implementationNaming = new UnknownFormatNaming(infrastructureImplementationType);
4718
- const specFile = aggregatesFolder.createFile(`${aggregateNaming.fileName}-repository.spec.ts`, `
4719
- import { describe, test, expect, beforeEach } from '${config_file_ConfigFile.backend.testingLibrary}'
4720
- ${config_file_ConfigFile.backend.domainFirstPackages.includes('@domain-first/wire') ? `import { wire${aggregateNaming.ClassName}Repository } from '../../../wiring/repositories/wire-${aggregateNaming.fileName}-repository'
4721
- import type { ${aggregateNaming.ClassName}Repository } from './${aggregateNaming.fileName}-repository'` : `import { ${implementationNaming.ClassName}${aggregateNaming.ClassName}Repository } from '../../../infrastructure/repositories/${implementationNaming.fileName}/${implementationNaming.fileName}-${aggregateNaming.fileName}-repository'
4722
-
4723
- type ${aggregateNaming.ClassName}Repository = ${implementationNaming.ClassName}${aggregateNaming.ClassName}Repository`}
4724
-
4725
- let ${aggregateNaming.variableName}Repository: ${aggregateNaming.ClassName}Repository
4726
-
4727
- beforeEach(() => {
4728
- ${aggregateNaming.variableName}Repository = ${config_file_ConfigFile.backend.domainFirstPackages.includes('@domain-first/wire') ? `wire${aggregateNaming.ClassName}Repository()` : `new ${implementationNaming.ClassName}${aggregateNaming.ClassName}Repository()`}
4729
- })
4730
-
4731
- describe('${aggregateNaming.withSpaces} repository', () => {
4732
- test('can be ${config_file_ConfigFile.backend.domainFirstPackages.includes('@domain-first/wire') ? 'wired' : 'created via constructor'}', () => {
4733
- expect(${aggregateNaming.variableName}Repository).toBeDefined()
4734
- })
4735
- })
4736
- `.trim());
4737
- if (!config_file_ConfigFile.backend.domainFirstPackages.includes('@domain-first/wire') && usesInMemoryDb(infrastructureImplementationType)) passInMemoryDb(specFile, `${implementationNaming.ClassName}${aggregateNaming.ClassName}Repository`);
4738
- }
4739
4694
  if (config_file_ConfigFile.backend.domainFirstPackages.includes('@domain-first/wire')) {
4740
4695
  const implementationNaming = new UnknownFormatNaming(infrastructureImplementationType);
4741
4696
  const testImplementationNaming = new UnknownFormatNaming(testImplementationType);
@@ -4761,7 +4716,6 @@ const scaffoldNewApplicationPort = async (boundedContextFolder)=>{
4761
4716
  message: 'Name: '
4762
4717
  });
4763
4718
  const naming = new UnknownFormatNaming(name);
4764
- const scaffoldUnitTests = Boolean(config_file_ConfigFile.backend.testingLibrary);
4765
4719
  const wiringFolder = boundedContextFolder.subitem([
4766
4720
  'wiring',
4767
4721
  'application-ports'
@@ -4801,28 +4755,6 @@ export abstract class ${naming.ClassName} {
4801
4755
  ownerPath: boundedContextFolder.path,
4802
4756
  labels: []
4803
4757
  }, implementation);
4804
- if (scaffoldUnitTests) {
4805
- const implementationNaming = new UnknownFormatNaming(implementationType);
4806
- applicationPortsFolder.createFile(`${naming.fileName}.spec.ts`, `
4807
- import { describe, test, expect, beforeEach } from '${config_file_ConfigFile.backend.testingLibrary}'
4808
- ${config_file_ConfigFile.backend.domainFirstPackages.includes('@domain-first/wire') ? `import { type ${naming.ClassName} } from './${naming.fileName}'
4809
- import { wire${naming.ClassName} } from '../../wiring/application-ports/wire-${naming.fileName}'` : `import { ${implementationNaming.ClassName}${naming.ClassName} } from '../../infrastructure/application-adapters/${implementationNaming.fileName}/${implementationNaming.fileName}-${naming.fileName}'
4810
-
4811
- type ${naming.ClassName} = ${implementationNaming.ClassName}${naming.ClassName}`}
4812
-
4813
- let ${naming.variableName}: ${naming.ClassName}
4814
-
4815
- beforeEach(() => {
4816
- ${naming.variableName} = ${config_file_ConfigFile.backend.domainFirstPackages.includes('@domain-first/wire') ? `wire${naming.ClassName}()` : `new ${implementationNaming.ClassName}${naming.ClassName}()`}
4817
- })
4818
-
4819
- describe('${naming.withSpaces}', () => {
4820
- test('can be ${config_file_ConfigFile.backend.domainFirstPackages.includes('@domain-first/wire') ? 'wired' : 'created via constructor'}', () => {
4821
- expect(${naming.variableName}).toBeDefined()
4822
- })
4823
- })
4824
- `.trim());
4825
- }
4826
4758
  if (config_file_ConfigFile.backend.domainFirstPackages.includes('@domain-first/wire')) {
4827
4759
  const wireFile = wiringFolder.createFile(`wire-${naming.fileName}.ts`, `
4828
4760
  import { wireClass } from '@domain-first/wire'
@@ -4918,9 +4850,7 @@ const scaffoldNewCommand = async (boundedContextFolder)=>{
4918
4850
  key: 'name',
4919
4851
  message: 'Name: '
4920
4852
  });
4921
- const scaffoldUnitTests = Boolean(config_file_ConfigFile.backend.testingLibrary);
4922
4853
  const naming = new UnknownFormatNaming(commandName);
4923
- const withWiring = config_file_ConfigFile.backend.domainFirstPackages.includes('@domain-first/wire');
4924
4854
  const { label: implementationType } = await promptImplementationType('Command infrastructure implementation type:', 'commands');
4925
4855
  let addTestImplementation = false;
4926
4856
  let testImplementationType = '';
@@ -4958,29 +4888,6 @@ export abstract class ${naming.ClassName}Command {
4958
4888
  export abstract class ${naming.ClassName}Command {
4959
4889
 
4960
4890
  }`.trim());
4961
- if (scaffoldUnitTests) {
4962
- const implementationNaming = new UnknownFormatNaming(implementationType);
4963
- const specFile = commandsFolder.createFile(`${naming.fileName}-command.spec.ts`, `
4964
- import { describe, test, expect, beforeEach } from '${config_file_ConfigFile.backend.testingLibrary}'
4965
- ${withWiring ? `import { type ${naming.ClassName}Command } from './${naming.fileName}-command'
4966
- import { wire${naming.ClassName}Command } from '../../wiring/commands/wire-${naming.fileName}-command'` : `import { ${implementationNaming.ClassName}${naming.ClassName}Command } from '../../infrastructure/commands/${implementationNaming.fileName}/${implementationNaming.fileName}-${naming.fileName}-command'
4967
-
4968
- type ${naming.ClassName}Command = ${implementationNaming.ClassName}${naming.ClassName}Command`}
4969
-
4970
- let ${naming.variableName}Command: ${naming.ClassName}Command
4971
-
4972
- beforeEach(() => {
4973
- ${naming.variableName}Command = ${withWiring ? `wire${naming.ClassName}Command()` : `new ${implementationNaming.ClassName}${naming.ClassName}Command()`}
4974
- })
4975
-
4976
- describe('${naming.withSpaces} command', () => {
4977
- test('can be ${withWiring ? 'wired' : 'created via constructor'}', () => {
4978
- expect(${naming.variableName}Command).toBeDefined()
4979
- })
4980
- })
4981
- `.trim());
4982
- if (!withWiring && usesInMemoryDb(implementationType)) passInMemoryDb(specFile, `${implementationNaming.ClassName}${naming.ClassName}Command`);
4983
- }
4984
4891
  if (config_file_ConfigFile.backend.domainFirstPackages.includes('@domain-first/wire')) {
4985
4892
  const implementationNaming = new UnknownFormatNaming(implementationType);
4986
4893
  const testImplementationNaming = new UnknownFormatNaming(testImplementationType);
@@ -5471,16 +5378,6 @@ const scaffoldNewInfrastructureHelper = async (ownerFolder)=>{
5471
5378
  ...name.folders
5472
5379
  ]);
5473
5380
  folder.createFile(`${fileName}.ts`, `export const ${naming.variableName} = () => {}`);
5474
- if (config_file_ConfigFile.backend.testingLibrary) folder.createFile(`${fileName}.spec.ts`, `
5475
- import { describe, test, expect } from '${config_file_ConfigFile.backend.testingLibrary}'
5476
- import { ${naming.variableName} } from './${fileName}'
5477
-
5478
- describe('${naming.withSpaces}', () => {
5479
- test('is defined', () => {
5480
- expect(${naming.variableName}).toBeDefined()
5481
- })
5482
- })
5483
- `.trim());
5484
5381
  };
5485
5382
  const scaffoldNewInfrastructureService = async (boundedContextFolder)=>{
5486
5383
  const name = await interaction_input({
@@ -5488,7 +5385,6 @@ const scaffoldNewInfrastructureService = async (boundedContextFolder)=>{
5488
5385
  message: 'Name: '
5489
5386
  });
5490
5387
  const naming = new UnknownFormatNaming(name);
5491
- const scaffoldUnitTests = Boolean(config_file_ConfigFile.backend.testingLibrary);
5492
5388
  const withWiring = config_file_ConfigFile.backend.domainFirstPackages.includes('@domain-first/wire');
5493
5389
  const wiringFolder = boundedContextFolder.subitem([
5494
5390
  'wiring',
@@ -5503,23 +5399,6 @@ export class ${naming.ClassName}InfrastructureService {
5503
5399
 
5504
5400
  }
5505
5401
  `.trim());
5506
- if (scaffoldUnitTests) infrastructureServicesFolder.createFile(`${naming.fileName}-infrastructure-service.spec.ts`, `
5507
- import { describe, test, expect, beforeEach } from '${config_file_ConfigFile.backend.testingLibrary}'
5508
- ${withWiring ? `import { type ${naming.ClassName}InfrastructureService } from './${naming.fileName}-infrastructure-service'
5509
- import { wire${naming.ClassName}InfrastructureService } from '../../wiring/infrastructure-services/wire-${naming.fileName}-infrastructure-service'` : `import { ${naming.ClassName}InfrastructureService } from './${naming.fileName}-infrastructure-service'`}
5510
-
5511
- let ${naming.variableName}InfrastructureService: ${naming.ClassName}InfrastructureService
5512
-
5513
- beforeEach(() => {
5514
- ${naming.variableName}InfrastructureService = ${withWiring ? `wire${naming.ClassName}InfrastructureService()` : `new ${naming.ClassName}InfrastructureService()`}
5515
- })
5516
-
5517
- describe('${naming.withSpaces}', () => {
5518
- test('can be ${withWiring ? 'wired' : 'created'}', () => {
5519
- expect(${naming.variableName}InfrastructureService).toBeDefined()
5520
- })
5521
- })
5522
- `.trim());
5523
5402
  if (withWiring) {
5524
5403
  const wireFile = wiringFolder.createFile(`wire-${naming.fileName}-infrastructure-service.ts`, `
5525
5404
  import { wireClass } from '@domain-first/wire'
@@ -5542,9 +5421,7 @@ const scaffoldNewQuery = async (boundedContextFolder)=>{
5542
5421
  key: 'name',
5543
5422
  message: 'Name: '
5544
5423
  });
5545
- const scaffoldUnitTests = Boolean(config_file_ConfigFile.backend.testingLibrary);
5546
5424
  const naming = new UnknownFormatNaming(queryName);
5547
- const withWiring = config_file_ConfigFile.backend.domainFirstPackages.includes('@domain-first/wire');
5548
5425
  const { label: implementationType } = await promptImplementationType('Query infrastructure implementation type:', 'queries');
5549
5426
  let addTestImplementation = false;
5550
5427
  let testImplementationType = '';
@@ -5582,29 +5459,6 @@ export abstract class ${naming.ClassName}Query {
5582
5459
  export abstract class ${naming.ClassName}Query {
5583
5460
 
5584
5461
  }`.trim());
5585
- if (scaffoldUnitTests) {
5586
- const implementationNaming = new UnknownFormatNaming(implementationType);
5587
- const specFile = queriesFolder.createFile(`${naming.fileName}-query.spec.ts`, `
5588
- import { describe, test, expect, beforeEach } from '${config_file_ConfigFile.backend.testingLibrary}'
5589
- ${withWiring ? `import { type ${naming.ClassName}Query } from './${naming.fileName}-query'
5590
- import { wire${naming.ClassName}Query } from '../../wiring/queries/wire-${naming.fileName}-query'` : `import { ${implementationNaming.ClassName}${naming.ClassName}Query } from '../../infrastructure/queries/${implementationNaming.fileName}/${implementationNaming.fileName}-${naming.fileName}-query'
5591
-
5592
- type ${naming.ClassName}Query = ${implementationNaming.ClassName}${naming.ClassName}Query`}
5593
-
5594
- let ${naming.variableName}Query: ${naming.ClassName}Query
5595
-
5596
- beforeEach(() => {
5597
- ${naming.variableName}Query = ${withWiring ? `wire${naming.ClassName}Query()` : `new ${implementationNaming.ClassName}${naming.ClassName}Query()`}
5598
- })
5599
-
5600
- describe('${naming.withSpaces} query', () => {
5601
- test('can be ${withWiring ? 'wired' : 'created via constructor'}', () => {
5602
- expect(${naming.variableName}Query).toBeDefined()
5603
- })
5604
- })
5605
- `.trim());
5606
- if (!withWiring && usesInMemoryDb(implementationType)) passInMemoryDb(specFile, `${implementationNaming.ClassName}${naming.ClassName}Query`);
5607
- }
5608
5462
  if (config_file_ConfigFile.backend.domainFirstPackages.includes('@domain-first/wire')) {
5609
5463
  const implementationNaming = new UnknownFormatNaming(implementationType);
5610
5464
  const testImplementationNaming = new UnknownFormatNaming(testImplementationType);
package/dist/react.cjs CHANGED
@@ -1023,23 +1023,6 @@ export const wireInMemoryDbInfrastructureService = wireClass(
1023
1023
  []
1024
1024
  );
1025
1025
  `;
1026
- const inMemoryDbSpec = (testingLibrary, withWiring)=>`
1027
- import { describe, test, expect, beforeEach } from '${testingLibrary}'
1028
- ${withWiring ? `import { type InMemoryDbInfrastructureService } from './in-memory-db-infrastructure-service'
1029
- import { wireInMemoryDbInfrastructureService } from '../../wiring/infrastructure-services/wire-in-memory-db-infrastructure-service'` : "import { InMemoryDbInfrastructureService } from './in-memory-db-infrastructure-service'"}
1030
-
1031
- let inMemoryDbInfrastructureService: InMemoryDbInfrastructureService
1032
-
1033
- beforeEach(() => {
1034
- inMemoryDbInfrastructureService = ${withWiring ? 'wireInMemoryDbInfrastructureService()' : 'new InMemoryDbInfrastructureService()'}
1035
- })
1036
-
1037
- describe('in memory db', () => {
1038
- test('can be ${withWiring ? 'wired' : 'created'}', () => {
1039
- expect(inMemoryDbInfrastructureService).toBeDefined()
1040
- })
1041
- })
1042
- `.trim();
1043
1026
  const in_memory_db_withWiring = ()=>config_file_ConfigFile.backend.domainFirstPackages.includes('@domain-first/wire');
1044
1027
  const in_memory_db_sharedFolder = ()=>new file_system_Folder(new project_root_ProjectRoot().path).subitem([
1045
1028
  config_file_ConfigFile.Instance.data.project.rootFolder,
@@ -1056,13 +1039,11 @@ const in_memory_db_wireFile = ()=>new file_system_File(in_memory_db_sharedFolder
1056
1039
  'wire-in-memory-db-infrastructure-service.ts'
1057
1040
  ]);
1058
1041
  const in_memory_db_scaffoldInMemoryDb = (shared)=>{
1059
- const { testingLibrary } = config_file_ConfigFile.backend;
1060
1042
  const servicesFolder = shared.subitem([
1061
1043
  'infrastructure',
1062
1044
  'services'
1063
1045
  ]);
1064
1046
  servicesFolder.createFile('in-memory-db-infrastructure-service.ts', inMemoryDbService);
1065
- if (testingLibrary) servicesFolder.createFile('in-memory-db-infrastructure-service.spec.ts', inMemoryDbSpec(testingLibrary, in_memory_db_withWiring()));
1066
1047
  if (in_memory_db_withWiring()) shared.subitem([
1067
1048
  'wiring',
1068
1049
  'infrastructure-services'
@@ -1124,9 +1105,6 @@ const wireInMemoryDb = (consumerWireFile, implementationName)=>{
1124
1105
  in_memory_db_wireName
1125
1106
  ]));
1126
1107
  };
1127
- const passInMemoryDb = (specFile, implementationName)=>{
1128
- specFile.update(addImport(specFile.data, `import { ${in_memory_db_className} } from '${relativeImport(specFile.path, serviceFile().path)}'`).replace(`new ${implementationName}()`, `new ${implementationName}(new ${in_memory_db_className}())`));
1129
- };
1130
1108
  const addInMemoryDb = ()=>{
1131
1109
  const config = config_file_ConfigFile.Instance.data;
1132
1110
  if (!config_file_ConfigFile.backend.withInMemoryDb) config_file_ConfigFile.update({
@@ -4713,29 +4691,6 @@ describe('${aggregateNaming.withSpaces}', () => {
4713
4691
  labels: []
4714
4692
  };
4715
4693
  for (const implementation of implementationTypes)createImplementation(boundedContextFolder, repository, new UnknownFormatNaming(implementation).fileName);
4716
- if (scaffoldUnitTests) {
4717
- const implementationNaming = new UnknownFormatNaming(infrastructureImplementationType);
4718
- const specFile = aggregatesFolder.createFile(`${aggregateNaming.fileName}-repository.spec.ts`, `
4719
- import { describe, test, expect, beforeEach } from '${config_file_ConfigFile.backend.testingLibrary}'
4720
- ${config_file_ConfigFile.backend.domainFirstPackages.includes('@domain-first/wire') ? `import { wire${aggregateNaming.ClassName}Repository } from '../../../wiring/repositories/wire-${aggregateNaming.fileName}-repository'
4721
- import type { ${aggregateNaming.ClassName}Repository } from './${aggregateNaming.fileName}-repository'` : `import { ${implementationNaming.ClassName}${aggregateNaming.ClassName}Repository } from '../../../infrastructure/repositories/${implementationNaming.fileName}/${implementationNaming.fileName}-${aggregateNaming.fileName}-repository'
4722
-
4723
- type ${aggregateNaming.ClassName}Repository = ${implementationNaming.ClassName}${aggregateNaming.ClassName}Repository`}
4724
-
4725
- let ${aggregateNaming.variableName}Repository: ${aggregateNaming.ClassName}Repository
4726
-
4727
- beforeEach(() => {
4728
- ${aggregateNaming.variableName}Repository = ${config_file_ConfigFile.backend.domainFirstPackages.includes('@domain-first/wire') ? `wire${aggregateNaming.ClassName}Repository()` : `new ${implementationNaming.ClassName}${aggregateNaming.ClassName}Repository()`}
4729
- })
4730
-
4731
- describe('${aggregateNaming.withSpaces} repository', () => {
4732
- test('can be ${config_file_ConfigFile.backend.domainFirstPackages.includes('@domain-first/wire') ? 'wired' : 'created via constructor'}', () => {
4733
- expect(${aggregateNaming.variableName}Repository).toBeDefined()
4734
- })
4735
- })
4736
- `.trim());
4737
- if (!config_file_ConfigFile.backend.domainFirstPackages.includes('@domain-first/wire') && usesInMemoryDb(infrastructureImplementationType)) passInMemoryDb(specFile, `${implementationNaming.ClassName}${aggregateNaming.ClassName}Repository`);
4738
- }
4739
4694
  if (config_file_ConfigFile.backend.domainFirstPackages.includes('@domain-first/wire')) {
4740
4695
  const implementationNaming = new UnknownFormatNaming(infrastructureImplementationType);
4741
4696
  const testImplementationNaming = new UnknownFormatNaming(testImplementationType);
@@ -4761,7 +4716,6 @@ const scaffoldNewApplicationPort = async (boundedContextFolder)=>{
4761
4716
  message: 'Name: '
4762
4717
  });
4763
4718
  const naming = new UnknownFormatNaming(name);
4764
- const scaffoldUnitTests = Boolean(config_file_ConfigFile.backend.testingLibrary);
4765
4719
  const wiringFolder = boundedContextFolder.subitem([
4766
4720
  'wiring',
4767
4721
  'application-ports'
@@ -4801,28 +4755,6 @@ export abstract class ${naming.ClassName} {
4801
4755
  ownerPath: boundedContextFolder.path,
4802
4756
  labels: []
4803
4757
  }, implementation);
4804
- if (scaffoldUnitTests) {
4805
- const implementationNaming = new UnknownFormatNaming(implementationType);
4806
- applicationPortsFolder.createFile(`${naming.fileName}.spec.ts`, `
4807
- import { describe, test, expect, beforeEach } from '${config_file_ConfigFile.backend.testingLibrary}'
4808
- ${config_file_ConfigFile.backend.domainFirstPackages.includes('@domain-first/wire') ? `import { type ${naming.ClassName} } from './${naming.fileName}'
4809
- import { wire${naming.ClassName} } from '../../wiring/application-ports/wire-${naming.fileName}'` : `import { ${implementationNaming.ClassName}${naming.ClassName} } from '../../infrastructure/application-adapters/${implementationNaming.fileName}/${implementationNaming.fileName}-${naming.fileName}'
4810
-
4811
- type ${naming.ClassName} = ${implementationNaming.ClassName}${naming.ClassName}`}
4812
-
4813
- let ${naming.variableName}: ${naming.ClassName}
4814
-
4815
- beforeEach(() => {
4816
- ${naming.variableName} = ${config_file_ConfigFile.backend.domainFirstPackages.includes('@domain-first/wire') ? `wire${naming.ClassName}()` : `new ${implementationNaming.ClassName}${naming.ClassName}()`}
4817
- })
4818
-
4819
- describe('${naming.withSpaces}', () => {
4820
- test('can be ${config_file_ConfigFile.backend.domainFirstPackages.includes('@domain-first/wire') ? 'wired' : 'created via constructor'}', () => {
4821
- expect(${naming.variableName}).toBeDefined()
4822
- })
4823
- })
4824
- `.trim());
4825
- }
4826
4758
  if (config_file_ConfigFile.backend.domainFirstPackages.includes('@domain-first/wire')) {
4827
4759
  const wireFile = wiringFolder.createFile(`wire-${naming.fileName}.ts`, `
4828
4760
  import { wireClass } from '@domain-first/wire'
@@ -4918,9 +4850,7 @@ const scaffoldNewCommand = async (boundedContextFolder)=>{
4918
4850
  key: 'name',
4919
4851
  message: 'Name: '
4920
4852
  });
4921
- const scaffoldUnitTests = Boolean(config_file_ConfigFile.backend.testingLibrary);
4922
4853
  const naming = new UnknownFormatNaming(commandName);
4923
- const withWiring = config_file_ConfigFile.backend.domainFirstPackages.includes('@domain-first/wire');
4924
4854
  const { label: implementationType } = await promptImplementationType('Command infrastructure implementation type:', 'commands');
4925
4855
  let addTestImplementation = false;
4926
4856
  let testImplementationType = '';
@@ -4958,29 +4888,6 @@ export abstract class ${naming.ClassName}Command {
4958
4888
  export abstract class ${naming.ClassName}Command {
4959
4889
 
4960
4890
  }`.trim());
4961
- if (scaffoldUnitTests) {
4962
- const implementationNaming = new UnknownFormatNaming(implementationType);
4963
- const specFile = commandsFolder.createFile(`${naming.fileName}-command.spec.ts`, `
4964
- import { describe, test, expect, beforeEach } from '${config_file_ConfigFile.backend.testingLibrary}'
4965
- ${withWiring ? `import { type ${naming.ClassName}Command } from './${naming.fileName}-command'
4966
- import { wire${naming.ClassName}Command } from '../../wiring/commands/wire-${naming.fileName}-command'` : `import { ${implementationNaming.ClassName}${naming.ClassName}Command } from '../../infrastructure/commands/${implementationNaming.fileName}/${implementationNaming.fileName}-${naming.fileName}-command'
4967
-
4968
- type ${naming.ClassName}Command = ${implementationNaming.ClassName}${naming.ClassName}Command`}
4969
-
4970
- let ${naming.variableName}Command: ${naming.ClassName}Command
4971
-
4972
- beforeEach(() => {
4973
- ${naming.variableName}Command = ${withWiring ? `wire${naming.ClassName}Command()` : `new ${implementationNaming.ClassName}${naming.ClassName}Command()`}
4974
- })
4975
-
4976
- describe('${naming.withSpaces} command', () => {
4977
- test('can be ${withWiring ? 'wired' : 'created via constructor'}', () => {
4978
- expect(${naming.variableName}Command).toBeDefined()
4979
- })
4980
- })
4981
- `.trim());
4982
- if (!withWiring && usesInMemoryDb(implementationType)) passInMemoryDb(specFile, `${implementationNaming.ClassName}${naming.ClassName}Command`);
4983
- }
4984
4891
  if (config_file_ConfigFile.backend.domainFirstPackages.includes('@domain-first/wire')) {
4985
4892
  const implementationNaming = new UnknownFormatNaming(implementationType);
4986
4893
  const testImplementationNaming = new UnknownFormatNaming(testImplementationType);
@@ -5471,16 +5378,6 @@ const scaffoldNewInfrastructureHelper = async (ownerFolder)=>{
5471
5378
  ...name.folders
5472
5379
  ]);
5473
5380
  folder.createFile(`${fileName}.ts`, `export const ${naming.variableName} = () => {}`);
5474
- if (config_file_ConfigFile.backend.testingLibrary) folder.createFile(`${fileName}.spec.ts`, `
5475
- import { describe, test, expect } from '${config_file_ConfigFile.backend.testingLibrary}'
5476
- import { ${naming.variableName} } from './${fileName}'
5477
-
5478
- describe('${naming.withSpaces}', () => {
5479
- test('is defined', () => {
5480
- expect(${naming.variableName}).toBeDefined()
5481
- })
5482
- })
5483
- `.trim());
5484
5381
  };
5485
5382
  const scaffoldNewInfrastructureService = async (boundedContextFolder)=>{
5486
5383
  const name = await interaction_input({
@@ -5488,7 +5385,6 @@ const scaffoldNewInfrastructureService = async (boundedContextFolder)=>{
5488
5385
  message: 'Name: '
5489
5386
  });
5490
5387
  const naming = new UnknownFormatNaming(name);
5491
- const scaffoldUnitTests = Boolean(config_file_ConfigFile.backend.testingLibrary);
5492
5388
  const withWiring = config_file_ConfigFile.backend.domainFirstPackages.includes('@domain-first/wire');
5493
5389
  const wiringFolder = boundedContextFolder.subitem([
5494
5390
  'wiring',
@@ -5503,23 +5399,6 @@ export class ${naming.ClassName}InfrastructureService {
5503
5399
 
5504
5400
  }
5505
5401
  `.trim());
5506
- if (scaffoldUnitTests) infrastructureServicesFolder.createFile(`${naming.fileName}-infrastructure-service.spec.ts`, `
5507
- import { describe, test, expect, beforeEach } from '${config_file_ConfigFile.backend.testingLibrary}'
5508
- ${withWiring ? `import { type ${naming.ClassName}InfrastructureService } from './${naming.fileName}-infrastructure-service'
5509
- import { wire${naming.ClassName}InfrastructureService } from '../../wiring/infrastructure-services/wire-${naming.fileName}-infrastructure-service'` : `import { ${naming.ClassName}InfrastructureService } from './${naming.fileName}-infrastructure-service'`}
5510
-
5511
- let ${naming.variableName}InfrastructureService: ${naming.ClassName}InfrastructureService
5512
-
5513
- beforeEach(() => {
5514
- ${naming.variableName}InfrastructureService = ${withWiring ? `wire${naming.ClassName}InfrastructureService()` : `new ${naming.ClassName}InfrastructureService()`}
5515
- })
5516
-
5517
- describe('${naming.withSpaces}', () => {
5518
- test('can be ${withWiring ? 'wired' : 'created'}', () => {
5519
- expect(${naming.variableName}InfrastructureService).toBeDefined()
5520
- })
5521
- })
5522
- `.trim());
5523
5402
  if (withWiring) {
5524
5403
  const wireFile = wiringFolder.createFile(`wire-${naming.fileName}-infrastructure-service.ts`, `
5525
5404
  import { wireClass } from '@domain-first/wire'
@@ -5542,9 +5421,7 @@ const scaffoldNewQuery = async (boundedContextFolder)=>{
5542
5421
  key: 'name',
5543
5422
  message: 'Name: '
5544
5423
  });
5545
- const scaffoldUnitTests = Boolean(config_file_ConfigFile.backend.testingLibrary);
5546
5424
  const naming = new UnknownFormatNaming(queryName);
5547
- const withWiring = config_file_ConfigFile.backend.domainFirstPackages.includes('@domain-first/wire');
5548
5425
  const { label: implementationType } = await promptImplementationType('Query infrastructure implementation type:', 'queries');
5549
5426
  let addTestImplementation = false;
5550
5427
  let testImplementationType = '';
@@ -5582,29 +5459,6 @@ export abstract class ${naming.ClassName}Query {
5582
5459
  export abstract class ${naming.ClassName}Query {
5583
5460
 
5584
5461
  }`.trim());
5585
- if (scaffoldUnitTests) {
5586
- const implementationNaming = new UnknownFormatNaming(implementationType);
5587
- const specFile = queriesFolder.createFile(`${naming.fileName}-query.spec.ts`, `
5588
- import { describe, test, expect, beforeEach } from '${config_file_ConfigFile.backend.testingLibrary}'
5589
- ${withWiring ? `import { type ${naming.ClassName}Query } from './${naming.fileName}-query'
5590
- import { wire${naming.ClassName}Query } from '../../wiring/queries/wire-${naming.fileName}-query'` : `import { ${implementationNaming.ClassName}${naming.ClassName}Query } from '../../infrastructure/queries/${implementationNaming.fileName}/${implementationNaming.fileName}-${naming.fileName}-query'
5591
-
5592
- type ${naming.ClassName}Query = ${implementationNaming.ClassName}${naming.ClassName}Query`}
5593
-
5594
- let ${naming.variableName}Query: ${naming.ClassName}Query
5595
-
5596
- beforeEach(() => {
5597
- ${naming.variableName}Query = ${withWiring ? `wire${naming.ClassName}Query()` : `new ${implementationNaming.ClassName}${naming.ClassName}Query()`}
5598
- })
5599
-
5600
- describe('${naming.withSpaces} query', () => {
5601
- test('can be ${withWiring ? 'wired' : 'created via constructor'}', () => {
5602
- expect(${naming.variableName}Query).toBeDefined()
5603
- })
5604
- })
5605
- `.trim());
5606
- if (!withWiring && usesInMemoryDb(implementationType)) passInMemoryDb(specFile, `${implementationNaming.ClassName}${naming.ClassName}Query`);
5607
- }
5608
5462
  if (config_file_ConfigFile.backend.domainFirstPackages.includes('@domain-first/wire')) {
5609
5463
  const implementationNaming = new UnknownFormatNaming(implementationType);
5610
5464
  const testImplementationNaming = new UnknownFormatNaming(testImplementationType);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@domain-first/project-structure",
3
3
  "description": "Build and manage your Domain-First project structure with CLI",
4
- "version": "8.7.0",
4
+ "version": "8.7.1",
5
5
  "type": "module",
6
6
  "repository": {
7
7
  "type": "git",
@@ -89,7 +89,7 @@ One file per unit in `references/units/`: when to choose it, how to generate it
89
89
  - **Contexts**: subfolders of `<rootFolder>/bounded-contexts/`.
90
90
  - **Names**: lowercase kebab-case, no generator suffix (`place-order`, not `place-order-use-case`). No empty segments (`a--b`).
91
91
  - **Collisions**: JSON requests require `overwrite: true` to replace changed existing files. Inspect `overwriteRequired` with `dryRun: true` and include those overwrites in the plan. The interactive equivalent asks `Overwrite them?`.
92
- - **Tests**: with `backend.testingLibrary` set, df-scaffold always generates specs; add a test implementation (`in-memory`/`mock`) to repositories, commands/queries, and ports. Otherwise the spec wires the real one. Without `backend.testingLibrary`, tell the user once and suggest adding it with `! npx df-integration` (Vitest); don't edit the config yourself.
92
+ - **Tests**: with `backend.testingLibrary` set, df-scaffold generates specs for modules without infrastructure (domain model, non-infrastructure services, use cases); repositories, commands/queries, ports, infrastructure services and helpers get none. Add a test implementation (`in-memory`/`mock`) to repositories, commands/queries and ports, so `NODE_ENV=test` specs of the use cases that inject them don't touch real infrastructure. Without `backend.testingLibrary`, tell the user once and suggest adding it with `! npx df-integration` (Vitest); don't edit the config yourself.
93
93
  - **Run order** in a plan: new contexts → domain (aggregates before their entities and value objects) → application (ports, commands/queries, use cases) → new implementations of existing contracts → endpoints → React (`df-ps-react`).
94
94
  - **Requests**: take the unit semantics and output files from its reference, then use `--describe` and `references/agent-mode.md` to build a JSON request.
95
95
 
@@ -85,15 +85,14 @@ describe('<label>', () => {
85
85
  })
86
86
  ```
87
87
 
88
- Without wire: import `<Class>` from `<noWire>`, use `new <Class>()` and the test name `<noWireTest>`. If `<noWire>` is an implementation, add `type <Type> = <Class>`.
88
+ Without wire: import `<Class>` from `<noWire>`, use `new <Class>()` and the test name `<noWireTest>`.
89
+
90
+ Only modules without infrastructure have specs. Repositories, commands, queries, ports, infrastructure services and helpers get none: don't create one for them.
89
91
 
90
92
  | Component | Spec next to | `<Type>` / `<var>` | `<wirePath>` | `<label>` | `<Class>` from `<noWire>`, `<noWireTest>` |
91
93
  | -------------------- | ---------------------------- | ----------------------------- | ------------------------------------------------ | -------------------- | -------------------------------------------------------------------------------------------------------- |
92
94
  | Aggregate root | `n.aggregate-root.ts` | `N` / `v` | none: `N.of({})` {types} (`can be instantiated via of`), `new N()` otherwise | `n words` | `N` `./n.aggregate-root`, `can be instantiated via constructor` |
93
- | Repository* | `n-repository.ts` | `NRepository` / `vRepository` | `../../../wiring/repositories/wire-n-repository` | `n words repository` | `INRepository` `../../../infrastructure/repositories/I/I-n-repository`, `can be created via constructor` |
94
- | Service | `n-L-service.ts` | `NLService` / `vLService` | `../../wiring/L-services/wire-n-L-service` | `n words` | `NLService` `./n-L-service`, `can be created` |
95
+ | Service (not infrastructure) | `n-L-service.ts` | `NLService` / `vLService` | `../../wiring/L-services/wire-n-L-service` | `n words` | `NLService` `./n-L-service`, `can be created` |
95
96
  | Use case | `n-use-case.ts` | `NUseCase` / `vUseCase` | `../../wiring/use-cases/wire-n-use-case` | `n words use case` | `NUseCase` `./n-use-case`, `can be created` |
96
- | Command | `n-command.ts` | `NCommand` / `vCommand` | `../../wiring/commands/wire-n-command` | `n words command` | `INCommand` `../../infrastructure/commands/I/I-n-command`, `can be created via constructor` |
97
- | Port | `n.ts` | `N` / `v` | `../../wiring/application-ports/wire-n` | `n words` | `IN` `../../infrastructure/application-adapters/I/I-n`, `can be created via constructor` |
98
97
 
99
- Entities and value objects (`n.entity.ts`, `n.value-object.ts`) follow the aggregate root row. `n words` = the name with spaces instead of hyphens. Queries are the same as commands. \*The repository spec imports the wire first, then `import type { NRepository } from './n-repository'`.
98
+ Entities and value objects (`n.entity.ts`, `n.value-object.ts`) follow the aggregate root row. `n words` = the name with spaces instead of hyphens.
@@ -7,7 +7,7 @@ When: a thing with identity, lifecycle, and rules about its own state, owned by
7
7
  Prompts: name → `With Repository` → primary implementation select → `Add a test implementation` → test implementation select if yes → {wire} dependencies per implementation. Each select contains saved repository types for that role, available system types and both manual-entry actions (`../generators.md`). `System: in-memory (uses the shared in-memory database)` appears only with the shared DB enabled and scaffolded. There are no ordinary presets; default to the first available saved/system choice, otherwise manual entry.
8
8
 
9
9
  - Custom types entered with the save action are staged in the shared config under `backend.implementations.repositories.primary` or `backend.implementations.repositories.test` and offered on later runs, including in other contexts. Both manual-entry actions from `../generators.md` are available; the run-only action generates the repository without remembering its type.
10
- - `<C>/domain/aggregates/n/`: `n.aggregate-root.ts` (`class N extends domainType()` {types}), `index.ts`, spec; with repository: `n-repository.ts` (`abstract class NRepository`), spec
10
+ - `<C>/domain/aggregates/n/`: `n.aggregate-root.ts` (`class N extends domainType()` {types}), `index.ts`, spec; with repository: `n-repository.ts` (`abstract class NRepository`), no spec
11
11
  - `<C>/infrastructure/repositories/I/I-n-repository.ts` per implementation (`class INRepository implements NRepository`)
12
12
  - {wire} `<C>/wiring/repositories/wire-n-repository.ts` (env-branched)
13
13
  - With `backend.withInMemoryDb` in the config, the `in-memory` implementation can keep its section of the DB: `private readonly data: InMemoryDbInfrastructureService['ns']`, set in the constructor from its `inMemoryDbInfrastructureService` parameter; `ns = this.section<N>('NS');` is added to `<rootFolder>/shared-kernel/infrastructure/services/in-memory-db-infrastructure-service.ts` if missing (`N` needs an `id`). Without {wire} this always happens. {wire} `Dependencies for InMemoryNRepository:` lists the DB under `Suggested`, checked: kept, it gets the section and `wireInMemoryDbInfrastructureService` in its `wireClass`; unchecked, the implementation stays empty (`constructor() {}`) and no section is added.
@@ -43,4 +43,4 @@ export class Order extends domainType(
43
43
 
44
44
  ## Test
45
45
 
46
- Extend the generated specs in the same files: aggregate rules on the root, the repository contract against the test implementation.
46
+ Extend the generated spec of the root with the aggregate rules. The repository has no unit spec: it is infrastructure, tested through integration tests and the use cases that inject its test implementation.
@@ -9,7 +9,7 @@ When (`../choosing-components.md`, step 11): one atomic read/write on this conte
9
9
 
10
10
  Prompts: name → primary implementation select → `Add a test implementation` → test implementation select if yes → {wire} dependencies per implementation. Menus contain saved types from `commands` or `queries` for the selected role, active system types and both manual-entry actions (`../generators.md`). Only `System: in-memory (uses the shared in-memory database)` can be automatic here, when its integration is ready. `api` and `mock` must be saved or entered manually. The first saved/system choice is the default, otherwise manual entry without a suggested name. Saving stages the new ordinary label for that category/role; run-only input leaves the catalog unchanged.
11
11
 
12
- - `<C>/application/commands/n-command.ts`: abstract `NCommand` ({handlers} schemas + abstract `handle: Handler<…>`), spec
12
+ - `<C>/application/commands/n-command.ts`: abstract `NCommand` ({handlers} schemas + abstract `handle: Handler<…>`), no spec
13
13
  - `<C>/infrastructure/commands/I/I-n-command.ts` per implementation (`extends NCommand`, implements `handle`)
14
14
  - {wire} `<C>/wiring/commands/wire-n-command.ts` (env-branched)
15
15
  - With `backend.withInMemoryDb` in the config, the `in-memory` implementation can get the whole DB: `constructor(private readonly inMemoryDbInfrastructureService: InMemoryDbInfrastructureService)`. No section is added. Without {wire} this always happens; {wire} it is the checked `Suggested` choice of `Dependencies for InMemoryN<Suffix>:`, and unchecking it leaves the implementation empty.
@@ -27,4 +27,4 @@ Queries: the same with `query` / `queries`.
27
27
 
28
28
  ## Test
29
29
 
30
- Extend the generated spec: the handler against the test implementation via `handle(...)`.
30
+ No unit spec: a command or query is infrastructure, tested through integration tests and the use cases that inject its test implementation.
@@ -8,7 +8,7 @@ Prompts: `Name (folders split by "/"):` → `Implementation:` (a type the projec
8
8
 
9
9
  JSON: `{ "operation": "helper", "context": "sales", "name": "mappers/social-network-type", "implementationType": "prisma" }`.
10
10
 
11
- - `<C>/infrastructure/helpers/I/<folders>/I-n.ts` (`export const iN = () => {}`), spec
11
+ - `<C>/infrastructure/helpers/I/<folders>/I-n.ts` (`export const iN = () => {}`), no spec
12
12
 
13
13
  A name that already starts with the type (`prisma-errors`) doesn't get the prefix twice. A helper of a type that isn't saved yet can't be generated: add an implementation of that type first, saving the type.
14
14
 
@@ -13,4 +13,4 @@ An implementation left without environments stays in the wire file; the CLI prin
13
13
 
14
14
  ## Implement and test
15
15
 
16
- As the implementations of the contract's unit file. The spec of the contract wires what `NODE_ENV=test` uses: only a new `test` implementation changes what it tests.
16
+ As the implementations of the contract's unit file. Contracts have no unit spec; specs of the use cases that inject the contract wire what `NODE_ENV=test` uses: only a new `test` implementation changes what they test.
@@ -6,7 +6,7 @@ When: a capability across this context's boundary: another bounded context, an e
6
6
 
7
7
  Prompts: name → primary adapter select → `With test implementation` → test adapter select if yes → {wire} dependencies per adapter. Both selects show saved port types for their role, active system types and both manual-entry actions (`../generators.md`). The only automatic system choice is `System: cross-context (calls handlers in another bounded context)`, conditional on a neighboring context and unavailable in the Shared Kernel. No `api`, `mock` or `in-memory` presets are inserted for ports. The first saved/system choice is the default; manual input is empty without saved choices. Existing labels are disabled. Saved ordinary port types are isolated from other categories. Save-entry updates `ports` history; run-only entry generates the adapter without updating the catalog.
8
8
 
9
- - `<C>/application/ports/n.ts` (abstract `N`; name it after the capability), spec
9
+ - `<C>/application/ports/n.ts` (abstract `N`; name it after the capability), no spec
10
10
  - `<C>/infrastructure/application-adapters/I/I-n.ts` per implementation (`class IN extends N`)
11
11
  - {wire} `<C>/wiring/application-ports/wire-n.ts` (env-branched)
12
12
 
@@ -11,7 +11,7 @@ When (`../choosing-components.md`, steps 12–15, "Port or service?"):
11
11
 
12
12
  Prompts: name → {wire} `Dependencies:` (`../generators.md`). `L` = `domain` | `application` | `infrastructure` | `presentation`.
13
13
 
14
- - `<C>/L/services/n-L-service.ts` (`class NLService`, e.g. `CheckoutApplicationService`), spec
14
+ - `<C>/L/services/n-L-service.ts` (`class NLService`, e.g. `CheckoutApplicationService`), spec except for `infrastructure`
15
15
  - {wire} `<C>/wiring/L-services/wire-n-L-service.ts` (`wireClass(X, [])`)
16
16
 
17
17
  ## Implement
@@ -23,4 +23,4 @@ Prompts: name → {wire} `Dependencies:` (`../generators.md`). `L` = `domain` |
23
23
 
24
24
  ## Test
25
25
 
26
- Test a service's logic with fake dependencies in its generated spec.
26
+ Test a domain, application or presentation service's logic with fake dependencies in its generated spec. Infrastructure services have no unit spec: integration tests cover them.