generator-sails-rest-api
Version:
Yeoman generator that provides already configured and optimized Sails REST API with bundle of predefined features
89 lines (80 loc) • 2.49 kB
JavaScript
;
const path = require('path');
const assert = require('yeoman-assert');
const test = require('yeoman-test');
const GENERATORS = [
[test.createDummyGenerator(), 'sails-rest-api:adapter'],
[test.createDummyGenerator(), 'sails-rest-api:authentication'],
[test.createDummyGenerator(), 'sails-rest-api:blueprint'],
[test.createDummyGenerator(), 'sails-rest-api:config'],
[test.createDummyGenerator(), 'sails-rest-api:controller'],
[test.createDummyGenerator(), 'sails-rest-api:cron'],
[test.createDummyGenerator(), 'sails-rest-api:hook'],
[test.createDummyGenerator(), 'sails-rest-api:logger'],
[test.createDummyGenerator(), 'sails-rest-api:model'],
[test.createDummyGenerator(), 'sails-rest-api:policy'],
[test.createDummyGenerator(), 'sails-rest-api:response'],
[test.createDummyGenerator(), 'sails-rest-api:service'],
[test.createDummyGenerator(), 'sails-rest-api:swagger']
];
describe('sails-rest-api:app', () => {
describe('Should properly scaffold with default configuration', () => {
before(() => {
return test
.run(path.join(__dirname, '../../generators/app'))
.withGenerators(GENERATORS)
});
it('Should properly create root files', () => {
assert.file([
'app.js',
'Dockerfile',
'.editorconfig',
'esdoc.json',
'.gitignore',
'package.json',
'README.md',
'.sailsrc'
]);
});
it('Should properly create mocha.opts and bootstrap', () => {
assert.file([
'test/bootstrap.js',
'test/mocha.opts'
]);
});
});
describe('Should properly scaffold with custom configuration', () => {
before(() => {
return test
.run(path.join(__dirname, '../../generators/app'))
.withGenerators(GENERATORS)
.withOptions({
'skip-update': true
})
.withPrompts({
'authentication:enabled': false,
'blueprint:all': false,
'cron:enabled': false,
'swagger:enabled': false
})
});
it('Should properly create root files', () => {
assert.file([
'app.js',
'Dockerfile',
'.editorconfig',
'esdoc.json',
'.gitignore',
'package.json',
'README.md',
'.sailsrc'
]);
});
it('Should properly create mocha.opts and bootstrap', () => {
assert.file([
'test/bootstrap.js',
'test/mocha.opts'
]);
});
});
});