Skip to content

Commit

Permalink
~ ci;
Browse files Browse the repository at this point in the history
  • Loading branch information
Spown committed Oct 24, 2017
1 parent 3a7042d commit 0630df4
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 15 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
"async": "^2.5.0",
"cookie-parser": "^1.4.1",
"express": "^4.16.2",
"fs-promise": "^2.0.3",
"jshint": "^2.9.5",
"mocha": "^3.5.3",
"should": "^13.1.2",
Expand Down
43 changes: 29 additions & 14 deletions test/i18n.configureAutoreload.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,34 @@
var reconfigure = require('./helpers/reconfig'),
i18n = require('../i18n'),
should = require('should'),
//fs = require('fs'),
fs = require('fs-promise'),
fs = require('fs'),
path = require('path'),
i18nFilename = path.resolve('i18n.js'),
timeout = 50
;


function clear(dir) {
if (i18n && i18n.disableReload) {
i18n.disableReload();
}
if (fs.existsSync(dir)) {
var s = fs.statSync(dir);
if (s.isDirectory()) {
(fs.readdirSync(dir)||[]).forEach(function(f) {
fs.unlinkSync(path.join(dir, f));
}, this);
fs.rmdirSync(dir);
}
}
}

describe('autoreload configuration', function() {

var testScope = {};
var directory = path.resolve(__dirname + '/../sandbox/testlocalesauto');
var directory = path.resolve(__dirname + '/../testlocalesauto');

before('start with empty catalogs, then change "de"', function(done) {
clear(directory);
fs.mkdirSync(directory);
fs.writeFileSync(directory + '/de.json', '{}');
fs.writeFileSync(directory + '/en.json', '{}');
Expand Down Expand Up @@ -52,17 +65,17 @@ describe('autoreload configuration', function() {
});

after('will remove testlocalesauto after tests', function() {
return fs.emptyDir(path.resolve(__dirname + '/../sandbox'));
clear(directory);
});
});

describe('autoreload configuration with prefix', function() {

var testScope = {};
var directory = path.resolve(__dirname + '/../sandbox/testlocalesautoprefixed');
var directory = path.resolve(__dirname + '/../testlocalesautoprefixed');

before('will start with empty catalogs', function(done) {
if (fs.existsSync(directory)) {fs.unlinkSync(directory);}
clear(directory);
fs.mkdirSync(directory);
fs.writeFileSync(directory + '/customprefix-de.json', '{}');
fs.writeFileSync(directory + '/customprefix-en.json', '{}');
Expand Down Expand Up @@ -95,17 +108,18 @@ describe('autoreload configuration with prefix', function() {
});

after('will remove testlocalesautoprefixed after tests', function() {
return fs.emptyDir(path.resolve(__dirname + '/../sandbox'));
clear(directory);
});

});

describe('autoreload configuration with prefix and customextension', function() {

var testScope = {};
var directory = path.resolve(__dirname + '/../sandbox/testlocalesautoprefixedext');
var directory = path.resolve(__dirname + '/../testlocalesautoprefixedext');

before('will start with empty catalogs', function(done) {
clear(directory);
fs.mkdirSync(directory);
fs.writeFileSync(directory + '/customprefix-de.customextension', '{}');
fs.writeFileSync(directory + '/customprefix-en.customextension', '{}');
Expand Down Expand Up @@ -139,17 +153,18 @@ describe('autoreload configuration with prefix and customextension', function()
});

after('will remove testlocalesautoprefixed after tests', function() {
return fs.emptyDir(path.resolve(__dirname + '/../sandbox'));
clear(directory);
});

});

describe('autoreload configuration with customextension', function() {

var testScope = {};
var directory = path.resolve(__dirname + '/../sandbox/testlocalesautocustomextension');
var directory = path.resolve(__dirname + '/../testlocalesautocustomextension');

before('will start with empty catalogs', function(done) {
clear(directory);
fs.mkdirSync(directory);
fs.writeFileSync(directory + '/de.customextension', '{}');
fs.writeFileSync(directory + '/en.customextension', '{}');
Expand Down Expand Up @@ -182,14 +197,14 @@ describe('autoreload configuration with customextension', function() {
});

after('will remove testlocalesautoprefixed after tests', function() {
return fs.emptyDir(path.resolve(__dirname + '/../sandbox'));
clear(directory);
});

});

describe('autoreload disabling', function() {
var testScope = {},
directory = path.resolve(__dirname + '/../sandbox/testlocalesautodisable')
directory = path.resolve(__dirname + '/../testlocalesautodisable')
;
function clearFS() {
fs.unlinkSync(directory + '/de.json');
Expand Down Expand Up @@ -257,7 +272,7 @@ describe('autoreload disabling', function() {
});

after(function () {
return fs.emptyDir(path.resolve(__dirname + '/../sandbox'));
clear(directory);
});

});

0 comments on commit 0630df4

Please sign in to comment.