{"size": 775, "ext": "js", "max_stars_repo_path": "NodeJs/node-unit-tests/test/test-i18n.js", "max_stars_repo_name": "pabagan/Knowledgebase", "max_stars_repo_stars_event_min_datetime": "2017-11-07T15:08:33.000Z", "max_stars_repo_stars_event_max_datetime": "2018-08-22T22:40:56.000Z", "max_issues_repo_path": "NodeJs/node-unit-tests/test/test-i18n.js", "max_issues_repo_name": "pabagan/knowledgebase", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "NodeJs/node-unit-tests/test/test-i18n.js", "max_forks_repo_name": "pabagan/knowledgebase", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 2, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 24.21875, "max_line_length": 69, "alphanum_fraction": 0.5006451613}


var assert = require('chai').assert;

var i18n = require('../app/i18n');


describe('i18n', function() {
    it('should return correct translation if available', function() {
        
        assert( i18n('hello'), 'hello' );
        assert( i18n('hello', 'en'), 'hello' );
        assert( i18n('hello', 'es'), 'hola' );
        assert( i18n('beer', 'es'), 'cervesa' );
        
    });
    
    it('should return the input on a missing phrase', function() {
        
        assert.equal( i18n('foobar'), 'foobar' );
        assert.equal( i18n('foobar', 'es'), 'foobar' );
        assert.equal( i18n('beer', 'jp'), 'beer' );
        
    });
    
    it('should handle mixed case', function() {
        
        assert.equal(i18n('Beer'), 'cervesa');
        
    });
});
