Skip to content

Commit

Permalink
Merge 8601a30 into 60d8d48
Browse files Browse the repository at this point in the history
  • Loading branch information
scotthallock authored Apr 5, 2023
2 parents 60d8d48 + 8601a30 commit 18e8778
Showing 1 changed file with 14 additions and 16 deletions.
30 changes: 14 additions & 16 deletions components/SubmissionComments.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ describe('Test SubmissionComments Component', () => {
variables: { userId: 3, challengeId: 6 },
data: { getPreviousSubmissions: submissionsData }
})
expect.assertions(4)

const { container, findByText } = render(
<MockedProvider cache={cache} addTypename={false} mocks={mocks}>
<Wrapper>
Expand All @@ -160,28 +160,26 @@ describe('Test SubmissionComments Component', () => {

const editButton = container.querySelector('.btn-outline-info.btn-sm')
fireEvent.click(editButton)
const discardButton = container.querySelector('.btn-light')

await waitFor(() => {
const discardButton = container.querySelector('.btn-light')
expect(discardButton).toBeInTheDocument()
expect(container.querySelector('.btn-info')).toBeInTheDocument()
expect(discardButton).toBeInTheDocument()
expect(container.querySelector('.btn-info')).toBeInTheDocument()

const editButtonTwo = container.querySelector('.btn-outline-info.btn-sm')
fireEvent.click(editButtonTwo)
const editButtonTwo = container.querySelector('.btn-outline-info.btn-sm')
fireEvent.click(editButtonTwo)

const warningText =
expect(
await findByText(
'You can only edit one comment in a single comment chain at a time.'
)
).toBeTruthy()

waitFor(() => {
expect(findByText(warningText)).toBeTruthy()
})
fireEvent.click(discardButton)
expect(editButton).toBeInTheDocument()

fireEvent.click(discardButton)
waitFor(() => {
expect(editButton).toBeInTheDocument()
})
})
expect.assertions(4)
})

it('should update comment when save changes button is clicked', async () => {
const cache = new InMemoryCache({ addTypename: false })

Expand Down

0 comments on commit 18e8778

Please sign in to comment.