Skip to content

Commit

Permalink
test: correct test case
Browse files Browse the repository at this point in the history
  • Loading branch information
louis-jan committed Nov 26, 2024
1 parent f227d35 commit 60a888c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 9 deletions.
4 changes: 1 addition & 3 deletions electron/tests/e2e/thread.e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ test('Select GPT model from Hub and Chat with Invalid API Key', async ({
{ timeout: TIMEOUT }
)

const APIKeyError = page.getByText(
`You didn't provide an API key. You need to provide your API key in an Authorization header using Bearer auth (i.e. Authorization: Bearer YOUR_KEY), or as the password field (with blank username) if you're accessing the API from your browser and are prompted for a username and password. You can obtain an API key from https://platform.openai.com/account/api-keys.`
)
const APIKeyError = page.getByTestId('passthrough-error-message')
await expect(APIKeyError).toBeVisible({
timeout: TIMEOUT,
})
Expand Down
6 changes: 1 addition & 5 deletions web/containers/ErrorMessage/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,7 @@ describe('ErrorMessage Component', () => {

render(<ErrorMessage message={message} />)

expect(
screen.getByText(
`You didn't provide an API key. You need to provide your API key in an Authorization header using Bearer auth (i.e. Authorization: Bearer YOUR_KEY), or as the password field (with blank username) if you're accessing the API from your browser and are prompted for a username and password. You can obtain an API key from https://platform.openai.com/account/api-keys.`
)
).toBeInTheDocument()
expect(screen.getByTestId('invalid-API-key-error')).toBeInTheDocument()
expect(screen.getByText('Settings')).toBeInTheDocument()
})

Expand Down
2 changes: 1 addition & 1 deletion web/containers/ErrorMessage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const ErrorMessage = ({ message }: { message: ThreadMessage }) => {
)
default:
return (
<p>
<p data-testid="passthrough-error-message">
{message.content[0]?.text?.value && (
<AutoLink text={message.content[0].text.value} />
)}
Expand Down

0 comments on commit 60a888c

Please sign in to comment.