@@ -26,10 +26,8 @@ const path = require('path');
26
26
// Import helpers from zap core
27
27
const templateUtil = require ( zapPath + 'dist/src-electron/generator/template-util.js' )
28
28
29
- const { DelayCommands } = require ( './simulated-clusters/TestDelayCommands.js' ) ;
30
- const { LogCommands } = require ( './simulated-clusters/TestLogCommands.js' ) ;
31
- const { Clusters, asBlocks, asPromise } = require ( './ClustersHelper.js' ) ;
32
- const { asUpperCamelCase } = require ( basePath + 'src/app/zap-templates/templates/app/helper.js' ) ;
29
+ const { getClusters, getCommands, getAttributes, isTestOnlyCluster } = require ( './simulated-clusters/SimulatedClusters.js' ) ;
30
+ const { asBlocks } = require ( './ClustersHelper.js' ) ;
33
31
34
32
const kClusterName = 'cluster' ;
35
33
const kEndpointName = 'endpoint' ;
@@ -341,37 +339,6 @@ function printErrorAndExit(context, msg)
341
339
process . exit ( 1 ) ;
342
340
}
343
341
344
- function getClusters ( )
345
- {
346
- // Create a new array to merge the configured clusters list and test
347
- // simulated clusters.
348
- return Clusters . getClusters ( ) . then ( clusters => clusters . concat ( DelayCommands , LogCommands ) ) ;
349
- }
350
-
351
- function getCommands ( clusterName )
352
- {
353
- switch ( clusterName ) {
354
- case DelayCommands . name :
355
- return Promise . resolve ( DelayCommands . commands ) ;
356
- case LogCommands . name :
357
- return Promise . resolve ( LogCommands . commands ) ;
358
- default :
359
- return Clusters . getClientCommands ( clusterName ) ;
360
- }
361
- }
362
-
363
- function getAttributes ( clusterName )
364
- {
365
- switch ( clusterName ) {
366
- case DelayCommands . name :
367
- return Promise . resolve ( DelayCommands . attributes ) ;
368
- case LogCommands . name :
369
- return Promise . resolve ( LogCommands . attributes ) ;
370
- default :
371
- return Clusters . getServerAttributes ( clusterName ) ;
372
- }
373
- }
374
-
375
342
function assertCommandOrAttribute ( context )
376
343
{
377
344
const clusterName = context . cluster ;
@@ -469,15 +436,6 @@ function chip_tests_items(options)
469
436
return templateUtil . collectBlocks ( this . tests , options , this ) ;
470
437
}
471
438
472
- function isTestOnlyCluster ( name )
473
- {
474
- const testOnlyClusters = [
475
- DelayCommands . name ,
476
- LogCommands . name ,
477
- ] ;
478
- return testOnlyClusters . includes ( name ) ;
479
- }
480
-
481
439
// test_cluster_command_value and test_cluster_value-equals are recursive partials using #each. At some point the |global|
482
440
// context is lost and it fails. Make sure to attach the global context as a property of the | value |
483
441
// that is evaluated.
0 commit comments