fix reading notification
This commit is contained in:
parent
2d1bac84e0
commit
cc4549d059
|
|
@ -23,7 +23,7 @@ const NotificationsList: React.FC = () => {
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
const read = async (id: string) => {
|
const read = async (id: string) => {
|
||||||
const { title, content, time } = await fetch.get<{
|
const { title, content, time } = await fetch.post<{
|
||||||
title: string
|
title: string
|
||||||
content: string
|
content: string
|
||||||
time: string
|
time: string
|
||||||
|
|
|
||||||
|
|
@ -49,12 +49,12 @@ test('read notification', async () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
createContainer([{ id: '1', title: 'hi' }])
|
createContainer([{ id: '1', title: 'hi' }])
|
||||||
fetch.get.mockResolvedValue(fixture)
|
fetch.post.mockResolvedValue(fixture)
|
||||||
|
|
||||||
const { getByText, queryByText } = render(<NotificationsList />)
|
const { getByText, queryByText } = render(<NotificationsList />)
|
||||||
|
|
||||||
fireEvent.click(getByText('hi'))
|
fireEvent.click(getByText('hi'))
|
||||||
await waitFor(() => expect(fetch.get).toBeCalled())
|
await waitFor(() => expect(fetch.post).toBeCalled())
|
||||||
|
|
||||||
expect(queryByText(fixture.title)).toBeInTheDocument()
|
expect(queryByText(fixture.title)).toBeInTheDocument()
|
||||||
expect(queryByText(fixture.content)).toBeInTheDocument()
|
expect(queryByText(fixture.content)).toBeInTheDocument()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user