Started generator tests
diff --git a/views/ngXosLib/generator-xos/package.json b/views/ngXosLib/generator-xos/package.json
old mode 100755
new mode 100644
index 58b5a33..5509586
--- a/views/ngXosLib/generator-xos/package.json
+++ b/views/ngXosLib/generator-xos/package.json
@@ -4,7 +4,7 @@
"description": "View generator for XOS",
"main": "index.js",
"scripts": {
- "test": "echo \"Error: no test specified\" && exit 1"
+ "test": "mocha test --timeout 5000"
},
"author": "Matteo Scandolo",
"license": "ISC",
@@ -13,5 +13,10 @@
},
"files": [
"app"
- ]
+ ],
+ "devDependencies": {
+ "mocha": "^2.4.5",
+ "yeoman-assert": "^2.2.1",
+ "yeoman-test": "^1.4.0"
+ }
}
diff --git a/views/ngXosLib/generator-xos/test/xos.spec.js b/views/ngXosLib/generator-xos/test/xos.spec.js
new file mode 100644
index 0000000..98be88b
--- /dev/null
+++ b/views/ngXosLib/generator-xos/test/xos.spec.js
@@ -0,0 +1,45 @@
+'use strict';
+
+const path = require('path');
+const helpers = require('yeoman-test');
+const assert = require('yeoman-assert');
+
+const testPath = path.join(__dirname, '../../../ngXosViews/test-name/');
+
+const getDefaultFiles = () => {
+ return [
+ testPath + 'src/index.html',
+ testPath + '.bowerrc',
+ testPath + '.gitignore',
+ testPath + '.eslintrc',
+ testPath + 'gulpfile.js',
+ testPath + 'package.json',
+ testPath + 'bower.json'
+ ];
+};
+
+describe('Yeoman XOS generator', function () {
+
+ beforeEach(function () {
+ this.generator = helpers
+ .run(require.resolve('../app'))
+ .inDir(testPath)
+ .withOptions({ 'skip-install': true })
+ .withPrompts({
+ name: 'test-name',
+ host: 'test-host',
+ token: 'test-token',
+ session: 'test-session'
+ });
+ });
+
+ describe('default settings', function () {
+ beforeEach(function (done) {
+ this.generator.on('end', done);
+ });
+
+ it('generate base files', function () {
+ assert.file(getDefaultFiles());
+ });
+ });
+});
\ No newline at end of file