signal-desktop/ts/test-node/app/updateDefaultSession_test.ts
2024-09-19 18:03:44 -07:00

35 lines
929 B
TypeScript

// Copyright 2022 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import * as sinon from 'sinon';
import { session } from 'electron';
import { v4 as uuid } from 'uuid';
import { updateDefaultSession } from '../../../app/updateDefaultSession';
describe('updateDefaultSession', () => {
let sandbox: sinon.SinonSandbox;
beforeEach(() => {
sandbox = sinon.createSandbox();
});
afterEach(() => {
sandbox.restore();
});
it('sets the spellcheck URL', () => {
const sesh = session.fromPartition(uuid());
const stub = sandbox.stub(sesh, 'setSpellCheckerDictionaryDownloadURL');
const getLogger = sandbox.stub();
updateDefaultSession(sesh, getLogger);
sinon.assert.calledOnce(stub);
sinon.assert.calledWith(
stub,
`https://updates.signal.org/desktop/hunspell_dictionaries/${process.versions.electron}/`
);
sinon.assert.notCalled(getLogger);
});
});