Skip to content

Commit

Permalink
update unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
pearl-truss committed Aug 31, 2023
1 parent 65db331 commit 86e2aaa
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ describe('ContractDetails', () => {
)

// check hint text
await screen.findByText('Supporting documents can be added later.')
await screen.findByText(
'Supporting documents can be added later. If you have additional contract actions, you must submit them in a separate submission.'
)
await screen.findByRole('link', { name: /Document definitions/ })

// check file input presences
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ describe('Documents', () => {
)

const input = screen.getByLabelText(
'Upload any additional supporting documents'
'Upload contract-supporting documents'
)
expect(input).toBeInTheDocument()
await userEvent.upload(input, [TEST_DOC_FILE])
Expand All @@ -89,7 +89,7 @@ describe('Documents', () => {
)

const input = screen.getByLabelText(
'Upload any additional supporting documents'
'Upload contract-supporting documents'
)
expect(input).toBeInTheDocument()
expect(input).toHaveAttribute('accept', ACCEPTED_SUBMISSION_FILE_TYPES)
Expand Down Expand Up @@ -195,7 +195,7 @@ describe('Documents', () => {
}
)
const input = screen.getByLabelText(
'Upload any additional supporting documents'
'Upload contract-supporting documents'
)
await userEvent.upload(input, [TEST_DOC_FILE])
await userEvent.upload(input, [TEST_PDF_FILE])
Expand Down Expand Up @@ -231,7 +231,7 @@ describe('Documents', () => {
}
)
const input = screen.getByLabelText(
'Upload any additional supporting documents'
'Upload contract-supporting documents'
)

await userEvent.upload(input, [TEST_XLS_FILE])
Expand Down Expand Up @@ -281,7 +281,7 @@ describe('Documents', () => {
}
)
const input = screen.getByLabelText(
'Upload any additional supporting documents'
'Upload contract-supporting documents'
)
await userEvent.upload(input, [TEST_DOC_FILE])
await userEvent.upload(input, [TEST_PDF_FILE])
Expand Down Expand Up @@ -328,7 +328,7 @@ describe('Documents', () => {
)

const input = screen.getByLabelText(
'Upload any additional supporting documents'
'Upload contract-supporting documents'
)
await userEvent.upload(input, [TEST_PDF_FILE])
await userEvent.upload(input, [TEST_DOC_FILE])
Expand Down Expand Up @@ -393,7 +393,7 @@ describe('Documents', () => {
)

const input = screen.getByLabelText(
'Upload any additional supporting documents'
'Upload contract-supporting documents'
)

await userEvent.upload(input, [TEST_DOC_FILE])
Expand Down Expand Up @@ -449,7 +449,7 @@ describe('Documents', () => {
name: 'Continue',
})
const input = screen.getByLabelText(
'Upload any additional supporting documents'
'Upload contract-supporting documents'
)

await userEvent.upload(input, [TEST_DOC_FILE])
Expand Down Expand Up @@ -481,7 +481,7 @@ describe('Documents', () => {
name: 'Continue',
})
const input = screen.getByLabelText(
'Upload any additional supporting documents'
'Upload contract-supporting documents'
)
const targetEl = screen.getByTestId('file-input-droptarget')

Expand Down Expand Up @@ -514,7 +514,7 @@ describe('Documents', () => {
}
)
const input = screen.getByLabelText(
'Upload any additional supporting documents'
'Upload contract-supporting documents'
)
const saveAsDraftButton = screen.getByRole('button', {
name: 'Save as draft',
Expand Down Expand Up @@ -597,7 +597,7 @@ describe('Documents', () => {
})

const input = screen.getByLabelText(
'Upload any additional supporting documents'
'Upload contract-supporting documents'
)
const targetEl = screen.getByTestId('file-input-droptarget')

Expand Down Expand Up @@ -687,7 +687,7 @@ describe('Documents', () => {
name: 'Save as draft',
})
const input = screen.getByLabelText(
'Upload any additional supporting documents'
'Upload contract-supporting documents'
)

await userEvent.upload(input, [TEST_DOC_FILE])
Expand Down Expand Up @@ -719,7 +719,7 @@ describe('Documents', () => {
name: 'Save as draft',
})
const input = screen.getByLabelText(
'Upload any additional supporting documents'
'Upload contract-supporting documents'
)
const targetEl = screen.getByTestId('file-input-droptarget')

Expand Down Expand Up @@ -778,7 +778,7 @@ describe('Documents', () => {
}
)
const input = screen.getByLabelText(
'Upload any additional supporting documents'
'Upload contract-supporting documents'
)
const saveAsDraftButton = screen.getByRole('button', {
name: 'Save as draft',
Expand Down Expand Up @@ -831,7 +831,7 @@ describe('Documents', () => {
name: 'Back',
})
const input = screen.getByLabelText(
'Upload any additional supporting documents'
'Upload contract-supporting documents'
)

await userEvent.upload(input, [TEST_DOC_FILE])
Expand Down Expand Up @@ -863,7 +863,7 @@ describe('Documents', () => {
name: 'Back',
})
const input = screen.getByLabelText(
'Upload any additional supporting documents'
'Upload contract-supporting documents'
)
const targetEl = screen.getByTestId('file-input-droptarget')

Expand Down Expand Up @@ -923,7 +923,7 @@ describe('Documents', () => {
}
)
const input = screen.getByLabelText(
'Upload any additional supporting documents'
'Upload contract-supporting documents'
)
const backButton = screen.getByRole('button', {
name: 'Back',
Expand Down Expand Up @@ -1005,7 +1005,7 @@ describe('Documents', () => {
)

const input = screen.getByLabelText(
'Upload any additional supporting documents'
'Upload contract-supporting documents'
)

await userEvent.upload(input, [TEST_DOC_FILE])
Expand Down Expand Up @@ -1057,7 +1057,7 @@ describe('Documents', () => {
)

const input = screen.getByLabelText(
'Upload any additional supporting documents'
'Upload contract-supporting documents'
)

await userEvent.upload(input, [TEST_DOC_FILE])
Expand Down Expand Up @@ -1175,7 +1175,7 @@ describe('Documents', () => {
name: 'Continue',
})
const input = screen.getByLabelText(
'Upload any additional supporting documents'
'Upload contract-supporting documents'
)

expect(input).toBeInTheDocument()
Expand Down Expand Up @@ -1238,7 +1238,7 @@ describe('Documents', () => {
name: 'Continue',
})
const input = screen.getByLabelText(
'Upload any additional supporting documents'
'Upload contract-supporting documents'
)
expect(input).toBeInTheDocument()
await userEvent.upload(input, [TEST_DOC_FILE])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ describe('RateDetails', () => {
screen.getByText('Rate certification type')
).toBeInTheDocument()
expect(
screen.getByText('Upload rate certification')
screen.getByText('Upload one rate certification document')
).toBeInTheDocument()
expect(
screen.getByRole('button', { name: 'Continue' })
Expand Down Expand Up @@ -275,7 +275,9 @@ describe('RateDetails', () => {
'Certification of capitation rates specific to each rate cell'
)
.click()
const input = screen.getByLabelText('Upload rate certification')
const input = screen.getByLabelText(
'Upload one rate certification document'
)
await userEvent.upload(input, [TEST_XLS_FILE])
const hasSharedRateFieldset = screen
.getByText(
Expand Down Expand Up @@ -452,7 +454,9 @@ describe('RateDetails', () => {
}
)

const input = screen.getByLabelText('Upload rate certification')
const input = screen.getByLabelText(
'Upload one rate certification document'
)
expect(input).toBeInTheDocument()
await userEvent.upload(input, [TEST_DOC_FILE])

Expand All @@ -475,7 +479,9 @@ describe('RateDetails', () => {
}
)

const input = screen.getByLabelText('Upload rate certification')
const input = screen.getByLabelText(
'Upload one rate certification document'
)
expect(input).toBeInTheDocument()
expect(input).toHaveAttribute(
'accept',
Expand Down Expand Up @@ -580,7 +586,7 @@ describe('RateDetails', () => {
const newRateCert = lastRateCertificationFromList(screen)
expect(newRateCert).toBeDefined()
const newRateInput = within(newRateCert!).getByLabelText(
'Upload rate certification'
'Upload one rate certification document'
)
expect(newRateInput).toBeInTheDocument()

Expand Down Expand Up @@ -1184,7 +1190,9 @@ describe('RateDetails', () => {
const continueButton = screen.getByRole('button', {
name: 'Continue',
})
const input = screen.getByLabelText('Upload rate certification')
const input = screen.getByLabelText(
'Upload one rate certification document'
)

await userEvent.upload(input, [TEST_DOC_FILE])

Expand All @@ -1210,7 +1218,9 @@ describe('RateDetails', () => {
const continueButton = screen.getByRole('button', {
name: 'Continue',
})
const input = screen.getByLabelText('Upload rate certification')
const input = screen.getByLabelText(
'Upload one rate certification document'
)
const targetEl = screen.getByTestId('file-input-droptarget')

await userEvent.upload(input, [TEST_DOC_FILE])
Expand Down Expand Up @@ -1268,7 +1278,9 @@ describe('RateDetails', () => {
}
)

const input = screen.getByLabelText('Upload rate certification')
const input = screen.getByLabelText(
'Upload one rate certification document'
)
const continueButton = screen.getByRole('button', {
name: 'Continue',
})
Expand Down Expand Up @@ -1396,7 +1408,9 @@ describe('RateDetails', () => {
const saveAsDraftButton = screen.getByRole('button', {
name: 'Save as draft',
})
const input = screen.getByLabelText('Upload rate certification')
const input = screen.getByLabelText(
'Upload one rate certification document'
)

await userEvent.upload(input, [TEST_DOC_FILE])

Expand All @@ -1423,7 +1437,9 @@ describe('RateDetails', () => {
const saveAsDraftButton = screen.getByRole('button', {
name: 'Save as draft',
})
const input = screen.getByLabelText('Upload rate certification')
const input = screen.getByLabelText(
'Upload one rate certification document'
)
const targetEl = screen.getByTestId('file-input-droptarget')

await userEvent.upload(input, [TEST_DOC_FILE])
Expand Down Expand Up @@ -1517,7 +1533,9 @@ describe('RateDetails', () => {
},
}
)
const input = screen.getByLabelText('Upload rate certification')
const input = screen.getByLabelText(
'Upload one rate certification document'
)
const saveAsDraftButton = screen.getByRole('button', {
name: 'Save as draft',
})
Expand Down Expand Up @@ -1561,7 +1579,9 @@ describe('RateDetails', () => {
const backButton = screen.getByRole('button', {
name: 'Back',
})
const input = screen.getByLabelText('Upload rate certification')
const input = screen.getByLabelText(
'Upload one rate certification document'
)

await userEvent.upload(input, [TEST_DOC_FILE])

Expand All @@ -1587,7 +1607,9 @@ describe('RateDetails', () => {
const backButton = screen.getByRole('button', {
name: 'Back',
})
const input = screen.getByLabelText('Upload rate certification')
const input = screen.getByLabelText(
'Upload one rate certification document'
)
const targetEl = screen.getByTestId('file-input-droptarget')

await userEvent.upload(input, [TEST_DOC_FILE])
Expand Down Expand Up @@ -1649,7 +1671,7 @@ describe('RateDetails', () => {
)

const rateCertInput = screen.getByLabelText(
'Upload rate certification'
'Upload one rate certification document'
)
const supportingDocsInput = screen.getByLabelText(
'Upload supporting documents (optional)'
Expand Down Expand Up @@ -1726,7 +1748,7 @@ const fillOutIndexRate = async (screen: Screen, index: number) => {

// assert proper initial fields are present
expect(
withinTargetRateCert.getByText('Upload rate certification')
withinTargetRateCert.getByText('Upload one rate certification document')
).toBeInTheDocument()
expect(
withinTargetRateCert.getByText(
Expand Down Expand Up @@ -1754,7 +1776,7 @@ const fillOutIndexRate = async (screen: Screen, index: number) => {

// add 1 doc
const input = withinTargetRateCert.getByLabelText(
'Upload rate certification'
'Upload one rate certification document'
)
await userEvent.upload(input, [TEST_DOC_FILE])

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,12 @@ export const SingleRateCert = ({
data-testid={`rate-certification-form`}
key={key}
id={`${fieldNamePrefix}.container.${rateInfo.id}`}
className={styles.rateCertContainer}
legend={
displayAsStandaloneRate
? `Rate certification`
: `Rate certification ${rateCertNumber}`
}
className={styles.rateCertContainer}
>
<FormGroup error={Boolean(showFieldErrors('rateDocuments'))}>
<FileUpload
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,7 @@ describe('StateSubmissionForm', () => {

await waitFor(() => {
expect(
screen.getByText(
'Upload any additional supporting documents'
)
screen.getByText('Upload contract-supporting documents')
).toBeInTheDocument()
expect(screen.getByTestId('file-input')).toBeInTheDocument()
})
Expand Down

0 comments on commit 86e2aaa

Please sign in to comment.