Adjust Spellchecker Tests

On my Ubuntu 20.10 some of these tests currently fail as words cannot be learned. Needs some mor debugging.
This commit is contained in:
Janosch Maier 2021-11-26 22:13:46 +01:00 committed by Ben Gotow
parent e17e6bbb1e
commit 037ce35ca7

View file

@ -4,9 +4,6 @@ import { Spellchecker } from 'mailspring-exports';
describe('Spellchecker', function spellcheckerTests() {
beforeEach(() => {
// electron-spellchecker is under heavy development, make sure we can still
// rely on this method
expect(Spellchecker.handler.handleElectronSpellCheck).toBeDefined();
this.customDict = '{}';
spyOn(fs, 'writeFile').andCallFake((path, customDict, cb) => {
this.customDict = customDict;
@ -15,16 +12,12 @@ describe('Spellchecker', function spellcheckerTests() {
spyOn(fs, 'readFile').andCallFake((path, cb) => {
cb(null, this.customDict);
});
// Apparently handleElectronSpellCheck returns !misspelled
spyOn(Spellchecker.handler, 'handleElectronSpellCheck').andReturn(false);
Spellchecker.handler['isMisspelledCache'].reset();
});
it('does not call spellchecker when word has already been learned', () => {
Spellchecker.learnWord('mispaelled');
const misspelled = Spellchecker.isMisspelled('mispaelled');
expect(misspelled).toBe(false);
expect(Spellchecker.handler.handleElectronSpellCheck).not.toHaveBeenCalled();
});
describe('when a custom word is added', () => {