Skip to content

Commit

Permalink
Fix UT issue
Browse files Browse the repository at this point in the history
  • Loading branch information
hkhanouchi committed Mar 8, 2023
1 parent ba2a938 commit 5278242
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 1 addition & 3 deletions src/components/message-input/giphy.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { shallow } from 'enzyme';
import React from 'react';
import { Giphy, GiphyComponents, Properties } from './giphy';
import { Grid } from '@giphy/react-components';

describe('Giphy', () => {
const subject = (props: Partial<Properties>) => {
Expand All @@ -22,7 +21,6 @@ describe('Giphy', () => {
addEventListener: jest.fn(),
removeEventListener: jest.fn(),
};
const fetchGifs = jest.fn();
});

afterEach(() => {
Expand All @@ -32,7 +30,7 @@ describe('Giphy', () => {
it('renders GiphyComponents', () => {
const wrapper = subject({});

expect(wrapper.find(GiphyComponents).exists()).toBeTrue();
expect(wrapper.find(GiphyComponents).exists()).toBe(true);
});

it('attach mousedown listener to document', () => {
Expand Down
3 changes: 2 additions & 1 deletion src/store/messages/saga.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,12 +233,13 @@ export function* editMessage(action) {

export function* uploadFileMessage(action) {
const { channelId, media } = action.payload;

const existingMessages = yield select(rawMessagesSelector(channelId));

if (!media.length) return;

let messages = [...existingMessages];
for (const file of media) {
for (const file of media.filter((i) => i.nativeFile)) {
const messagesResponse = yield call(uploadFileMessageApi, channelId, file.nativeFile);
messages.push(messagesResponse);
}
Expand Down

0 comments on commit 5278242

Please sign in to comment.