forked from balderdashy/sails
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request balderdashy#1749 from netantho/tests-i18n
Integration tests for i18n hook
- Loading branch information
Showing
1 changed file
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
}); | ||
}); | ||
}); |