From 263b3f9e9effcde904ecc86eb047e9ace8b3bb06 Mon Sep 17 00:00:00 2001 From: Chris Bobbe Date: Thu, 10 Sep 2020 11:58:45 -0700 Subject: [PATCH] migrateMessages tests: Remove unnecessary uses of `omit`. As noted in the comments, Flow has gotten a bit smarter, so we can write this code more straightforwardly. --- src/api/messages/__tests__/migrateMessages-test.js | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/api/messages/__tests__/migrateMessages-test.js b/src/api/messages/__tests__/migrateMessages-test.js index 83d60bc9e5c..05f1c80ded7 100644 --- a/src/api/messages/__tests__/migrateMessages-test.js +++ b/src/api/messages/__tests__/migrateMessages-test.js @@ -1,6 +1,4 @@ /* @flow strict-local */ -import omit from 'lodash.omit'; - import { migrateMessages } from '../getMessages'; import { identityOfAuth } from '../../../account/accountMisc'; import * as eg from '../../../__tests__/lib/exampleData'; @@ -21,13 +19,8 @@ describe('migrateMessages', () => { }, }; - type CommonFields = $Diff; - const serverMessage: ServerMessage = { - // The `omit` shouldn't be necessary with Flow v0.111: "Spreads - // now overwrite properties instead of inferring unions" - // (https://medium.com/flow-type/spreads-common-errors-fixes-9701012e9d58). - ...(omit(eg.streamMessage(), 'reactions'): CommonFields), + ...eg.streamMessage(), reactions: [serverReaction], }; @@ -35,8 +28,7 @@ describe('migrateMessages', () => { const expectedOutput: Message[] = [ { - // The `omit` shouldn't be necessary with Flow v0.111. - ...(omit(serverMessage, 'reactions'): CommonFields), + ...serverMessage, reactions: [ { user_id: reactingUser.user_id,