diff --git a/src/components/Message.test.tsx b/src/components/Message.test.tsx index 7cce7d1..df2bc7c 100644 --- a/src/components/Message.test.tsx +++ b/src/components/Message.test.tsx @@ -1,5 +1,4 @@ import { render, screen } from '@testing-library/react' -import dayjs from 'dayjs' import React from 'react' import Message from './Message' @@ -15,33 +14,13 @@ describe('Message', function () { attachments: [], geo_information: '{"type":"FeatureCollection","features":[]}', } - const { asFragment } = render( - - ) + const { asFragment } = render() expect(asFragment()).toMatchSnapshot() expect(screen.getByText('a few seconds ago')).toBeInTheDocument() }) - test('renders with prepended time', function () { - const time = new Date() - const message = { - id: '1', - text: 'message', - ticker: 1, - creation_date: time, - tweet_id: '', - tweet_user: '', - attachments: [], - geo_information: '{"type":"FeatureCollection","features":[]}', - } - - render() - - expect(screen.getByText(dayjs(time).format('HH:mm') + ' message')) - }) - test('renders with map correctly', function () { const message = { id: '1', @@ -54,9 +33,7 @@ describe('Message', function () { geo_information: '{"type":"FeatureCollection","features":[{"type":"Feature","geometry":{"type":"Point","coordinates":[13.466282,52.5024]},"properties":null}]}', } - const { asFragment } = render( - - ) + const { asFragment } = render() expect(asFragment()).toMatchSnapshot() }) diff --git a/src/components/Message.tsx b/src/components/Message.tsx index 8c2fc4b..337601f 100644 --- a/src/components/Message.tsx +++ b/src/components/Message.tsx @@ -18,7 +18,6 @@ const AttachmentsWrapper = styled(Card.Content)` interface Props { message: MessageType - prependTime: boolean } const Message: FC = props => { @@ -30,20 +29,12 @@ const Message: FC = props => { ) const creationDate = dayjs(props.message.creation_date).format('LLLL') - function prependTime() { - if (props.prependTime) { - return dayjs(props.message.creation_date).format('HH:mm') + ' ' - } - - return '' - } - return (
diff --git a/src/components/MessageList.test.tsx b/src/components/MessageList.test.tsx index 32eecab..3b665ff 100644 --- a/src/components/MessageList.test.tsx +++ b/src/components/MessageList.test.tsx @@ -15,7 +15,7 @@ describe('MessageList', function () { .fn() .mockImplementation(intersectionObserverMock) - render() + render() expect(screen.getByText('Loading messages')).toBeInTheDocument() expect( diff --git a/src/components/MessageList.tsx b/src/components/MessageList.tsx index 4c4f5ff..49ce98f 100644 --- a/src/components/MessageList.tsx +++ b/src/components/MessageList.tsx @@ -6,7 +6,6 @@ import { getTimeline } from '../lib/api' interface Props { refreshInterval: number - prependTime: boolean } const MessageList: FC = props => { @@ -130,11 +129,7 @@ const MessageList: FC = props => { return (
{messages.map(message => ( - + ))} {!lastMessageReceived && (
diff --git a/src/lib/types.ts b/src/lib/types.ts index 4de246c..51d4016 100644 --- a/src/lib/types.ts +++ b/src/lib/types.ts @@ -5,7 +5,6 @@ export type Ticker = { domain: string id: string title: string - prepend_time: boolean information: TickerInformation } diff --git a/src/views/ActiveView.tsx b/src/views/ActiveView.tsx index b6a66fd..3752fba 100644 --- a/src/views/ActiveView.tsx +++ b/src/views/ActiveView.tsx @@ -40,10 +40,7 @@ const ActiveView: FC = props => { {headline && } - + ) } @@ -57,10 +54,7 @@ const ActiveView: FC = props => {
- +