Skip to content

Commit

Permalink
test(config): test load prod conf ✅
Browse files Browse the repository at this point in the history
  • Loading branch information
PierreBrisorgueil committed Jun 8, 2019
1 parent 2a25df4 commit 84b1078
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion config/defaults/development.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
app: {
title: 'WeAreOpenSource Node',
title: 'WeAreOpenSource Node - Development Environment',
description: 'Full-Stack JavaScript with MongoDB, Express, AngularJS, and Node.js',
keywords: 'mongodb, express, angularjs, node.js, mongoose, passport',
googleAnalyticsTrackingID: 'WAOS_NODE_app_googleAnalyticsTrackingID',
Expand Down
3 changes: 3 additions & 0 deletions config/defaults/production.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ const _ = require('lodash');
const defaultConfig = require('./development');

module.exports = _.merge(defaultConfig, {
app: {
title: 'WeAreOpenSource Node - Production Environment',
},
host: '0.0.0.0',
db: {
uri: 'mongodb://localhost/WaosNode',
Expand Down
12 changes: 12 additions & 0 deletions modules/core/tests/core.config.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,18 @@ describe('Configuration Tests:', () => {

let originalLogConfig;

describe('Testing Configurations', () => {
test('should load production configuration', async () => {
try {
const defaultConfig = require(path.join(process.cwd(), './config', 'defaults', 'production')) || {};
expect(defaultConfig.app.title.split(' - ')[1]).toBe('Production Environment');
} catch (err) {
console.log(err);
expect(err).toBeFalsy();
}
});
});

describe('Testing default seedDB', () => {
beforeAll((done) => {
user1 = {
Expand Down

0 comments on commit 84b1078

Please sign in to comment.