Skip to content

Commit

Permalink
migrateMessages tests: Remove unnecessary uses of omit.
Browse files Browse the repository at this point in the history
As noted in the comments, Flow has gotten a bit smarter, so we can
write this code more straightforwardly.
  • Loading branch information
chrisbobbe committed Sep 21, 2020
1 parent 4165c28 commit 263b3f9
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/api/messages/__tests__/migrateMessages-test.js
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -21,22 +19,16 @@ describe('migrateMessages', () => {
},
};

type CommonFields = $Diff<Message, { reactions: mixed }>;

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],
};

const input: ServerMessage[] = [serverMessage];

const expectedOutput: Message[] = [
{
// The `omit` shouldn't be necessary with Flow v0.111.
...(omit(serverMessage, 'reactions'): CommonFields),
...serverMessage,
reactions: [
{
user_id: reactingUser.user_id,
Expand Down

0 comments on commit 263b3f9

Please sign in to comment.