From 6a7ff423ff82bd6eb7fbfbc95f4b1ebda36cc842 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karol=20S=C3=B3jko?= Date: Fri, 20 Jan 2023 10:45:16 +0100 Subject: [PATCH] fix(snjs): remove isFailed() checks during tests in order for getValue() to give a meaningful exception --- packages/snjs/mocha/history.test.js | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/packages/snjs/mocha/history.test.js b/packages/snjs/mocha/history.test.js index bed7de3bb..b8b6b9551 100644 --- a/packages/snjs/mocha/history.test.js +++ b/packages/snjs/mocha/history.test.js @@ -286,7 +286,6 @@ describe('history manager', () => { await this.application.syncService.sync(syncOptions) const itemHistoryOrError = await this.application.listRevisions.execute({ itemUuid: item.uuid }) - expect(itemHistoryOrError.isFailed()).to.equal(false) expect(itemHistoryOrError.getValue().length).to.equal(0) }) @@ -295,8 +294,6 @@ describe('history manager', () => { await Factory.sleep(Factory.ServerRevisionCreationDelay) let itemHistoryOrError = await this.application.listRevisions.execute({ itemUuid: item.uuid }) - expect(itemHistoryOrError.isFailed()).to.equal(false) - let itemHistory = itemHistoryOrError.getValue() /** Server history should save initial revision */ @@ -305,8 +302,6 @@ describe('history manager', () => { /** Sync within 5 seconds (ENV VAR dependend on self-hosted setup), should not create a new entry */ await Factory.markDirtyAndSyncItem(this.application, item) itemHistoryOrError = await this.application.listRevisions.execute({ itemUuid: item.uuid }) - expect(itemHistoryOrError.isFailed()).to.equal(false) - itemHistory = itemHistoryOrError.getValue() expect(itemHistory.length).to.equal(1) @@ -322,8 +317,6 @@ describe('history manager', () => { ) await Factory.sleep(Factory.ServerRevisionCreationDelay) itemHistoryOrError = await this.application.listRevisions.execute({ itemUuid: item.uuid }) - expect(itemHistoryOrError.isFailed()).to.equal(false) - itemHistory = itemHistoryOrError.getValue() expect(itemHistory.length).to.equal(1) }) @@ -346,15 +339,11 @@ describe('history manager', () => { await Factory.sleep(Factory.ServerRevisionCreationDelay) const itemHistoryOrError = await this.application.listRevisions.execute({ itemUuid: item.uuid }) - expect(itemHistoryOrError.isFailed()).to.equal(false) - const itemHistory = itemHistoryOrError.getValue() expect(itemHistory.length).to.equal(2) const oldestEntry = lastElement(itemHistory) let revisionFromServerOrError = await this.application.getRevision.execute({ itemUuid: item.uuid, revisionUuid: oldestEntry.uuid }) - expect(revisionFromServerOrError.isFailed()).to.equal(false) - const revisionFromServer = revisionFromServerOrError.getValue() expect(revisionFromServer).to.be.ok @@ -376,12 +365,9 @@ describe('history manager', () => { await Factory.sleep(Factory.ServerRevisionCreationDelay) const dupeHistoryOrError = await this.application.listRevisions.execute({ itemUuid: dupe.uuid }) - expect(dupeHistoryOrError.isFailed()).to.equal(false) const dupeHistory = dupeHistoryOrError.getValue() const dupeRevisionOrError = await this.application.getRevision.execute({ itemUuid: dupe.uuid, revisionUuid: dupeHistory[0].uuid }) - expect(dupeRevisionOrError.isFailed()).to.equal(false) - const dupeRevision = dupeRevisionOrError.getValue() expect(dupeRevision.payload.uuid).to.equal(dupe.uuid) }) @@ -405,11 +391,9 @@ describe('history manager', () => { const expectedRevisions = 4 const noteHistoryOrError = await this.application.listRevisions.execute({ itemUuid: note.uuid }) - expect(noteHistoryOrError.isFailed()).to.equal(false) const noteHistory = noteHistoryOrError.getValue() const dupeHistoryOrError = await this.application.listRevisions.execute({ itemUuid: dupe.uuid }) - expect(dupeHistoryOrError.isFailed()).to.equal(false) const dupeHistory = dupeHistoryOrError.getValue() expect(noteHistory.length).to.equal(expectedRevisions) @@ -432,15 +416,11 @@ describe('history manager', () => { await Factory.sleep(Factory.ServerRevisionCreationDelay) const itemHistoryOrError = await this.application.listRevisions.execute({ itemUuid: dupe.uuid }) - expect(itemHistoryOrError.isFailed()).to.equal(false) - const itemHistory = itemHistoryOrError.getValue() expect(itemHistory.length).to.be.above(1) const newestRevision = itemHistory[0] const fetchedOrError = await this.application.getRevision.execute({ itemUuid: dupe.uuid, revisionUuid: newestRevision.uuid }) - expect(fetchedOrError.isFailed()).to.equal(false) - const fetched = fetchedOrError.getValue() expect(fetched.payload.errorDecrypting).to.not.be.ok expect(fetched.payload.content.title).to.equal(changedText)