Skip to content

Commit

Permalink
refactor: fix failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
manusa committed Dec 28, 2019
1 parent e05503a commit 1704556
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
3 changes: 0 additions & 3 deletions src/settings/browser-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,6 @@ const init = () => {
settingsForm.addEventListener('submit', event => event.preventDefault());

[initNewTab, initSpellCheckerSettings, initTabsSettings, initButtons].forEach(f => f.call(this, settings));



};

init();
22 changes: 22 additions & 0 deletions src/spell-check/__tests__/index.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
describe('Spell-check module test suite', () => {
let mockSettings;
let spellCheck;
beforeEach(() => {
mockSettings = {
enabledDictionaries: []
};
jest.resetModules();
jest.mock('../../settings', () => ({
loadSettings: jest.fn(() => mockSettings)
}));
spellCheck = require('../');
});
test('getEnabledDictionaries, should return persisted enabled dictionaries', () => {
// Given
mockSettings.enabledDictionaries = ['13-37'];
// When
const result = spellCheck.getEnabledDictionaries();
// Then
expect(result).toEqual(['13-37']);
});
});

0 comments on commit 1704556

Please sign in to comment.