UNPKG

chrome-stub

Version:

Easily stub out chrome API calls for great test coverage

50 lines (39 loc) 1.36 kB
var I18n = hmt.lib('chrome', 'I18n'); var path = require('path'); describe('chrome.I18n', function () { var api; beforeEach(function () { api = new I18n(); api.loadDefaults(hmt.path('fixtures', 'messages.json')); }); describe('getMessage', function(){ var cb = hmt.spy(); describe('with callback', function () { it('should provide spy functionality', function () { var test = api.getMessage('test', ['one']); hmt.assert.equal(test, 'test one'); }); }); }); describe('_locales', function(){ it('should provide spy functionality', function () { var test = api._locales; hmt.assert.equal(test.test.message, 'test $1', 'make sure messages.json has test'); }); }); // describe('setLocale', function(){ // it('should set a local without error', function () { // var test = api.setLocale('GB'); // debugger; // hmt.assert(!test, 'test without error'); // }); // }); // describe('setMessagesPath', function(){ // it('should set a setMessagesPath different from default', function () { // var dir = path.join(__dirname, '/../../../fixtures/messages.json'); // api.setMessagesPath(dir); // var test = api._locales; // hmt.assert(test.fixture.message === 'test', 'test without error'); // }); // }); });