Skip to content

Commit 507fc7b

Browse files
committed
fix(tests): Clever new tests fixed
1 parent 4a92e8b commit 507fc7b

1 file changed

Lines changed: 7 additions & 16 deletions

File tree

tests/new/backend.test.js

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ describe( 'New (backend seed)', function ( ) {
1616

1717
expect( fs.existsSync( path.join( assetPath, 'my-new-project', 'backend', 'modules', 'TestingNew', 'config', 'default.json' ) ) ).to.be.true;
1818
expect( fs.existsSync( path.join( assetPath, 'my-new-project', 'backend', 'modules', 'TestingNew', 'controllers', 'TestingNewController.js' ) ) ).to.be.true;
19-
expect( fs.existsSync( path.join( assetPath, 'my-new-project', 'backend', 'modules', 'TestingNew', 'models', 'odm', 'TestingNewModel.js' ) ) ).to.be.true;
20-
expect( fs.existsSync( path.join( assetPath, 'my-new-project', 'backend', 'modules', 'TestingNew', 'models', 'orm', 'TestingNewModel.js' ) ) ).to.be.true;
19+
expect( fs.existsSync( path.join( assetPath, 'my-new-project', 'backend', 'modules', 'TestingNew', 'models', 'TestingNewModel.js' ) ) ).to.be.true;
2120
expect( fs.existsSync( path.join( assetPath, 'my-new-project', 'backend', 'modules', 'TestingNew', 'schema', 'seedData.json' ) ) ).to.be.true;
2221
expect( fs.existsSync( path.join( assetPath, 'my-new-project', 'backend', 'modules', 'TestingNew', 'services', 'TestingNewService.js' ) ) ).to.be.true;
2322
expect( fs.existsSync( path.join( assetPath, 'my-new-project', 'backend', 'modules', 'TestingNew', 'tasks', 'TestingNewTask.js' ) ) ).to.be.true;
@@ -26,21 +25,16 @@ describe( 'New (backend seed)', function ( ) {
2625
expect( fs.existsSync( path.join( assetPath, 'my-new-project', 'backend', 'modules', 'TestingNew', 'tests', 'unit', 'TestingNewTest.js' ) ) ).to.be.true;
2726

2827
var controller = fs.readFileSync( path.join( assetPath, 'my-new-project', 'backend', 'modules', 'TestingNew', 'controllers', 'TestingNewController.js' ) );
29-
expect( controller ).to.match( /module\.exports = function\( TestingNewService \) \{/ );
28+
expect( controller ).to.match( /module\.exports = function\( Controller, TestingNewService \) \{/ );
3029
expect( controller ).to.match( /service: TestingNewService/ );
31-
expect( controller ).to.match( /message: "Hello from customAction inside TestingNewController"/ );
3230

33-
var odmModel = fs.readFileSync( path.join( assetPath, 'my-new-project', 'backend', 'modules', 'TestingNew', 'models', 'odm', 'TestingNewModel.js' ) );
34-
expect( odmModel ).to.match( /return mongoose\.model\('TestingNew', ModelSchema\);/ );
35-
36-
var ormModel = fs.readFileSync( path.join( assetPath, 'my-new-project', 'backend', 'modules', 'TestingNew', 'models', 'orm', 'TestingNewModel.js' ) );
37-
expect( ormModel ).to.match( /return sequelize.define\("TestingNew", \{/ );
31+
var model = fs.readFileSync( path.join( assetPath, 'my-new-project', 'backend', 'modules', 'TestingNew', 'models', 'TestingNewModel.js' ) );
32+
expect( model ).to.match( /return Model\.extend\( "TestingNew",/ );
3833

3934
var service = fs.readFileSync( path.join( assetPath, 'my-new-project', 'backend', 'modules', 'TestingNew', 'services', 'TestingNewService.js' ) );
40-
expect( service ).to.match( /TestingNewService = BaseService.extend\(\{/ );
41-
expect( service ).to.match( /TestingNewService\.instance = new TestingNewService\( sequelize \);/ );
42-
expect( service ).to.match( /TestingNewService\.Model = ORMTestingNewModel;/ );
43-
expect( service ).to.match( /return TestingNewService\.instance;/ );
35+
expect( service ).to.match( /module\.exports = function\( Service, TestingNewModel \) \{/ );
36+
expect( service ).to.match( /return Service\.extend\(\{/ );
37+
expect( service ).to.match( /model\: TestingNewModel/ );
4438

4539
var task = fs.readFileSync( path.join( assetPath, 'my-new-project', 'backend', 'modules', 'TestingNew', 'tasks', 'TestingNewTask.js' ) );
4640
expect( task ).to.match( /var TestingNewTask = module\.exports = Class\.extend\(/ );
@@ -52,13 +46,10 @@ describe( 'New (backend seed)', function ( ) {
5246
expect( testInt ).to.match( /describe \( 'GET \/testing_new\/:id', function \(\) \{/ );
5347
expect( testInt ).to.match( /describe \( 'PUT \/testing_new\/:id', function \(\) \{/ );
5448
expect( testInt ).to.match( /describe \( 'DELETE \/testing_new\/:id', function \(\) \{/ );
55-
expect( testInt ).to.match( /describe \( 'GET \/testing_new\/custom', function \(\) \{/ );
56-
expect( testInt ).to.match( /message: 'Hello from customAction inside TestingNewController'/ );
5749

5850
var testUnit = fs.readFileSync( path.join( assetPath, 'my-new-project', 'backend', 'modules', 'TestingNew', 'tests', 'unit', 'TestingNewTest.js' ) );
5951
expect( testUnit ).to.match( /describe \( 'controllers\.TestingNewController', function \(\) \{/ );
6052
expect( testUnit ).to.match( /testEnv \( function \( TestingNewController, TestingNewService \) \{/ );
61-
expect( testUnit ).to.match( /message: 'Hello from customAction inside TestingNewController'/ );
6253

6354
done( err );
6455
} );

0 commit comments

Comments
 (0)