GT2/GT2-iOS/node_modules/getenv/test/disableErrors.js

25 lines
656 B
JavaScript

var assert = require('assert');
var getenv = require('../lib/getenv');
var tests = {};
tests['getenv.disableErrors() should disable any errors'] = function() {
getenv.disableErrors();
assert.strictEqual(getenv.string('url', 'http://localhost'), 'http://localhost');
assert(getenv.string('url'), undefined);
};
tests['getenv.enableErrors() should enable errors'] = function () {
getenv.enableErrors();
assert.throws(function() {
getenv.string('url');
});
assert.strictEqual(getenv.string('url', 'http://localhost'), 'http://localhost');
}
Object.keys(tests).forEach(function(key) {
console.log('Test: %s', key);
tests[key]();
});