Updated generator to read parent env config
diff --git a/views/ngXosLib/generator-xos/test/build.spec.js b/views/ngXosLib/generator-xos/test/build.spec.js
index dd49b03..19c338b 100644
--- a/views/ngXosLib/generator-xos/test/build.spec.js
+++ b/views/ngXosLib/generator-xos/test/build.spec.js
@@ -14,6 +14,9 @@
}
}
+// config files
+const cfg = path.join(__dirname, `../../../env/default.js`);
+
// source files
const viewName = 'testDashboard';
const fileName = viewName.replace(/^./, viewName[0].toUpperCase());
@@ -32,6 +35,12 @@
this.timeout(getMillisec(5));
before(done => {
+ // if `default.js` config is not present
+ // create one (we check to avoid screwing up local envs)
+ if(!fs.existsSync(cfg)){
+ fs.writeFileSync(cfg, 'module.exports = {}');
+ }
+
console.log('Running generator');
this.generator = helpers
.run(require.resolve('../app'))
diff --git a/views/ngXosLib/generator-xos/test/generator.spec.js b/views/ngXosLib/generator-xos/test/generator.spec.js
index 4ae1602..2c7abb5 100644
--- a/views/ngXosLib/generator-xos/test/generator.spec.js
+++ b/views/ngXosLib/generator-xos/test/generator.spec.js
@@ -65,10 +65,7 @@
.inDir(testPath)
.withOptions({ 'skip-install': true })
.withPrompts({
- name: viewName,
- host: 'test-host',
- token: 'test-token',
- session: 'test-session'
+ name: viewName
})
.on('end', done);
});
@@ -78,12 +75,6 @@
assert.file(getDefaultFiles());
});
- it('should create the env file with correct params', () => {
- assert.fileContent(`${testPath}env/default.js`, 'host: \'test-host\'');
- assert.fileContent(`${testPath}env/default.js`, 'xoscsrftoken: \'test-token\'');
- assert.fileContent(`${testPath}env/default.js`, 'xossessionid: \'test-session\'');
- });
-
it('should write username in package & bower json', () => {
assert.fileContent(`${testPath}package.json`, '"author": "Test User"');
assert.fileContent(`${testPath}bower.json`, '"Test User <test@mail.org>"')