1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-10-18 20:09:08 +02:00
unleash.unleash/lib/options.test.js

32 lines
892 B
JavaScript
Raw Normal View History

2016-12-01 00:42:14 +01:00
'use strict';
const test = require('ava');
delete process.env.DATABASE_URL;
const { createOptions } = require('./options');
test('should require DATABASE_URI', t => {
t.throws(() => {
const options = createOptions({});
});
});
test('should set default databaseUri for develpment', t => {
process.env.NODE_ENV = 'development';
const { createOptions } = require('./options');
const options = createOptions({});
t.true(options.databaseUri === 'postgres://unleash_user:passord@localhost:5432/unleash');
});
test('should not override provided options', t => {
process.env.DATABASE_URL = 'test';
process.env.NODE_ENV = 'production';
const { createOptions } = require('./options');
const options = createOptions({databaseUri: 'test', port: 1111});
t.true(options.databaseUri === 'test');
t.true(options.port === 1111);
});