remove console suppression, fixing I18n mock
This commit is contained in:
parent
4edbb66c91
commit
70007285bf
|
@ -50,15 +50,9 @@ var a2zString = ['a','b','c','d','e','f','g','h','i','j','k','l','m',
|
||||||
'`': '`',
|
'`': '`',
|
||||||
'=': '='
|
'=': '='
|
||||||
},
|
},
|
||||||
logFile = fs.createWriteStream('test.log'),
|
|
||||||
mimeFile = fs.createReadStream('/etc/mime.types'),
|
mimeFile = fs.createReadStream('/etc/mime.types'),
|
||||||
mimeLine = '';
|
mimeLine = '';
|
||||||
|
|
||||||
// redirect console messages to log file
|
|
||||||
console.info = console.warn = console.error = function () {
|
|
||||||
logFile.write(Array.prototype.slice.call(arguments).join('') + '\n');
|
|
||||||
};
|
|
||||||
|
|
||||||
// populate mime types from environment
|
// populate mime types from environment
|
||||||
mimeFile.on('data', function(data) {
|
mimeFile.on('data', function(data) {
|
||||||
mimeLine += data;
|
mimeLine += data;
|
||||||
|
|
|
@ -87,14 +87,17 @@ describe('I18n', function () {
|
||||||
'downloads and handles any supported language',
|
'downloads and handles any supported language',
|
||||||
common.jscSupportedLanguages(),
|
common.jscSupportedLanguages(),
|
||||||
function(language) {
|
function(language) {
|
||||||
var clean = jsdom('', {url: 'https://privatebin.net/', cookie: ['lang=' + language]});
|
// cleanup
|
||||||
|
var clean = jsdom('', {cookie: ['lang=en']});
|
||||||
$.PrivateBin.I18n.reset('en');
|
$.PrivateBin.I18n.reset('en');
|
||||||
$.PrivateBin.I18n.loadTranslations();
|
$.PrivateBin.I18n.loadTranslations();
|
||||||
|
clean();
|
||||||
|
|
||||||
|
// mock
|
||||||
|
clean = jsdom('', {cookie: ['lang=' + language]});
|
||||||
$.PrivateBin.I18n.reset(language, require('../../i18n/' + language + '.json'));
|
$.PrivateBin.I18n.reset(language, require('../../i18n/' + language + '.json'));
|
||||||
var result = $.PrivateBin.I18n.translate('en'),
|
var result = $.PrivateBin.I18n.translate('en'),
|
||||||
alias = $.PrivateBin.I18n._('en');
|
alias = $.PrivateBin.I18n._('en');
|
||||||
|
|
||||||
clean();
|
clean();
|
||||||
return language === result && language === alias;
|
return language === result && language === alias;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue