Skip to content

Commit

Permalink
Merge pull request balderdashy#1749 from netantho/tests-i18n
Browse files Browse the repository at this point in the history
Integration tests for i18n hook
  • Loading branch information
sgress454 committed Jun 11, 2014
2 parents e6dd2e5 + 9b55ef4 commit d577fb1
Showing 1 changed file with 77 additions and 0 deletions.
77 changes: 77 additions & 0 deletions test/integration/hook.i18n.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
var assert = require('assert');
var httpHelper = require('./helpers/httpHelper.js');
var appHelper = require('./helpers/appHelper');
var path = require('path');
var fs = require('fs');

describe('i18n ::', function() {

var appName = 'testApp';

beforeEach(function(done) {
appHelper.lift({
verbose: false
}, function(err, sails) {
if (err) {
throw new Error(err);
}
sailsprocess = sails;
sailsprocess.once('hook:http:listening', done);
});
});

afterEach(function(done) {
sailsprocess.kill(done);
});

before(function(done) {
this.timeout(5000);
appHelper.build(done);
});

after(function() {
// console.log('before `chdir ../`' + ', cwd was :: ' + process.cwd());
process.chdir('../');
// console.log('after `chdir ../`' + ', cwd was :: ' + process.cwd());
appHelper.teardown();
});

describe('with locales generate by sails-generate-backend', function () {
it('should say "Welcome" by default', function(done) {
assert(sailsprocess.__('Welcome') == 'Welcome');
done();
});

it('should say "Welcome" in English', function(done) {
assert(sailsprocess.__({
phrase: 'Welcome',
locale: 'en'
}) == 'Welcome');
done();
});

it('should say "Bienvenido" in Spanish', function(done) {
assert(sailsprocess.__({
phrase: 'Welcome',
locale: 'es'
}) == 'Bienvenido');
done();
});

it('should say "Bienvenue" in French', function(done) {
assert(sailsprocess.__({
phrase: 'Welcome',
locale: 'fr'
}) == 'Bienvenue');
done();
});

it('should say "Wilkommen" in German', function(done) {
assert(sailsprocess.__({
phrase: 'Welcome',
locale: 'de'
}) == 'Wilkommen');
done();
});
});
});

0 comments on commit d577fb1

Please sign in to comment.