const { test } = require('ava');
const envConfig = require('../');

const ENV = {
  CONFIG_mongo_db: 'mongo.db1',
  CONFIG__mongo__db: 'mongo.db2',
};

test.before(() => {
  Object.assign(process.env, ENV);
});

test('should load mongo db', (t) => {
  const config = envConfig();
  t.is(config.mongo.db, 'mongo.db1');
  t.is(Object.keys(config).length, 1);
});

test('should load mongo db with another separator', (t) => {
  const config = envConfig({ separator: '__' });
  t.is(config.mongo.db, 'mongo.db2');
  t.is(Object.keys(config).length, 1);
});

@@ -141,16 +141,49 @@
 o.db2',%0A
+  ACONFIG_mongo_db: 'mongo.db3',%0A
 %7D;%0A%0Atest
@@ -559,28 +559,219 @@
 eys(config).length, 1);%0A%7D);%0A
+%0Atest('should load mongo db with another prefix', (t) =%3E %7B%0A  const config = envConfig(%7B prefix: 'ACONFIG' %7D);%0A  t.is(config.mongo.db, 'mongo.db3');%0A  t.is(Object.keys(config).length, 1);%0A%7D);%0A

prefix test case