mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-02-23 23:54:13 +08:00
feat(signatures): Fix specs
This commit is contained in:
parent
5b12dd6ebd
commit
1387f219f1
3 changed files with 10 additions and 5 deletions
|
@ -15,7 +15,9 @@ describe('SignatureComposerExtension', function signatureComposerExtension() {
|
|||
describe("prepareNewDraft", () => {
|
||||
describe("when a signature is defined", () => {
|
||||
beforeEach(() => {
|
||||
spyOn(NylasEnv.config, 'get').andCallFake(() => TEST_SIGNATURES);
|
||||
spyOn(NylasEnv.config, 'get').andCallFake((key) =>
|
||||
(key === 'nylas.signatures' ? TEST_SIGNATURES : null)
|
||||
);
|
||||
spyOn(SignatureStore, 'signatureForEmail').andReturn(TEST_SIGNATURE)
|
||||
SignatureStore.activate()
|
||||
});
|
||||
|
|
|
@ -22,7 +22,7 @@ const DEFAULTS = {
|
|||
|
||||
describe('SignatureStore', function signatureStore() {
|
||||
beforeEach(() => {
|
||||
spyOn(NylasEnv.config, 'get').andCallFake(() => SIGNATURES)
|
||||
spyOn(NylasEnv.config, 'get').andCallFake((key) => (key === 'nylas.signatures' ? SIGNATURES : null))
|
||||
|
||||
spyOn(SignatureStore, '_saveSignatures').andCallFake(() => {
|
||||
NylasEnv.config.set(`nylas.signatures`, SignatureStore.signatures)
|
||||
|
@ -44,8 +44,10 @@ describe('SignatureStore', function signatureStore() {
|
|||
|
||||
describe('removeSignature', () => {
|
||||
beforeEach(() => {
|
||||
spyOn(NylasEnv.config, 'set').andCallFake((notImportant, newObject) => {
|
||||
SIGNATURES = newObject
|
||||
spyOn(NylasEnv.config, 'set').andCallFake((key, newObject) => {
|
||||
if (key === 'nylas.signatures') {
|
||||
SIGNATURES = newObject;
|
||||
}
|
||||
})
|
||||
})
|
||||
it('should remove the signature from our list of signatures', () => {
|
||||
|
|
|
@ -24,7 +24,6 @@ class SignatureStore extends NylasStore {
|
|||
this.trigger()
|
||||
});
|
||||
this.signatures = NylasEnv.config.get(`nylas.signatures`) || {}
|
||||
this.selectedSignatureId = this._setSelectedSignatureId()
|
||||
this.defaultSignatures = NylasEnv.config.get(`nylas.defaultSignatures`) || {}
|
||||
|
||||
// backfill the new signatures structure with old signatures from < v0.4.45
|
||||
|
@ -44,6 +43,8 @@ class SignatureStore extends NylasStore {
|
|||
this._saveDefaultSignatures();
|
||||
}
|
||||
|
||||
this.selectedSignatureId = this._setSelectedSignatureId()
|
||||
|
||||
this.trigger()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue