fix reading notification

This commit is contained in:
Pig Fang 2020-07-12 11:02:29 +08:00
parent 2d1bac84e0
commit cc4549d059
No known key found for this signature in database
GPG Key ID: A8198F548DADA9E2
2 changed files with 3 additions and 3 deletions

View File

@ -23,7 +23,7 @@ const NotificationsList: React.FC = () => {
}, [])
const read = async (id: string) => {
const { title, content, time } = await fetch.get<{
const { title, content, time } = await fetch.post<{
title: string
content: string
time: string

View File

@ -49,12 +49,12 @@ test('read notification', async () => {
}
createContainer([{ id: '1', title: 'hi' }])
fetch.get.mockResolvedValue(fixture)
fetch.post.mockResolvedValue(fixture)
const { getByText, queryByText } = render(<NotificationsList />)
fireEvent.click(getByText('hi'))
await waitFor(() => expect(fetch.get).toBeCalled())
await waitFor(() => expect(fetch.post).toBeCalled())
expect(queryByText(fixture.title)).toBeInTheDocument()
expect(queryByText(fixture.content)).toBeInTheDocument()