Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/components/UIUC-Components/WebScrape.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -194,18 +194,18 @@ export const WebScrape = ({
if (!maxUrls) {
errors.maxUrls = {
error: true,
message: 'Please provide an input for Max URLs',
message: 'Please provide an input for Max Pages',
}
} else if (!/^\d+$/.test(maxUrls)) {
// Using regex to ensure the entire string is a number
errors.maxUrls = {
error: true,
message: 'Max URLs should be a valid number',
message: 'Max Pages should be a valid number',
}
} else if (parseInt(maxUrls) < 1 || parseInt(maxUrls) > 500) {
errors.maxUrls = {
error: true,
message: 'Max URLs should be between 1 and 500',
message: 'Max Pages should be between 1 and 500',
}
}

Expand Down Expand Up @@ -587,7 +587,7 @@ export const WebScrape = ({
style={{ color: '#C1C2C5', fontSize: '16px' }}
className={`${montserrat_heading.variable} font-montserratHeading`}
>
Max URLs (1 to 500)
Max Pages (1 to 500)
</Text>
<TextInput
styles={{ input: { backgroundColor: '#1A1B1E' } }}
Expand Down
10 changes: 5 additions & 5 deletions src/components/UIUC-Components/WebsiteIngestForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,13 @@ export default function WebsiteIngestForm({

let errorMessage = ''
if (!value) {
errorMessage = 'Please provide an input for Max URLs'
errorMessage = 'Please provide an input for Max Pages'
} else if (!/^\d+$/.test(value)) {
errorMessage = 'Max URLs should be a valid number'
errorMessage = 'Max Pages should be a valid number'
} else {
const numValue = parseInt(value)
if (numValue < 1 || numValue > 500) {
errorMessage = 'Max URLs should be between 1 and 500'
errorMessage = 'Max Pages should be between 1 and 500'
}
}

Expand Down Expand Up @@ -124,7 +124,7 @@ export default function WebsiteIngestForm({
setOpen(false)

if (maxUrlsHasError) {
alert('Invalid max URLs input (1 to 500)')
alert('Invalid Max Pages input (1 to 500)')
return
}

Expand Down Expand Up @@ -501,7 +501,7 @@ export default function WebsiteIngestForm({
style={{ fontSize: '16px' }}
className={`${montserrat_heading.variable} font-montserratHeading`}
>
Max URLs (1 to 500)
Max Pages (1 to 500)
</Text>

<TextInput
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ describe('WebScrape', () => {
await user.click(screen.getByRole('button', { name: /Ingest/i }))

expect(
await screen.findByText(/Max URLs should be a valid number/i),
await screen.findByText(/Max Pages should be a valid number/i),
).toBeInTheDocument()
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ describe('WebsiteIngestForm', () => {
await user.type(screen.getByPlaceholderText('Default 50'), '0')

expect(
await screen.findByText(/Max URLs should be between 1 and 500/i),
await screen.findByText(/Max Pages should be between 1 and 500/i),
).toBeInTheDocument()

await user.type(
Expand All @@ -232,7 +232,7 @@ describe('WebsiteIngestForm', () => {
screen.getByRole('button', { name: /Ingest the Website/i }),
)

expect(alertSpy).toHaveBeenCalledWith('Invalid max URLs input (1 to 500)')
expect(alertSpy).toHaveBeenCalledWith('Invalid Max Pages input (1 to 500)')
expect((axiosMod as any).default.post).not.toHaveBeenCalled()
})

Expand Down