Skip to content

Commit bb15ff3

Browse files
committed
✅ Fix up broken test ... in an interesting way
1 parent 6cdaf88 commit bb15ff3

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

static/app/components/searchQueryBuilder/index.spec.tsx

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4478,9 +4478,16 @@ describe('SearchQueryBuilder', function () {
44784478

44794479
describe('user clicks on enable gen ai button', () => {
44804480
it('calls promptsUpdate', async () => {
4481-
const organization = OrganizationFixture();
4481+
const organization = OrganizationFixture({
4482+
slug: 'org-slug',
4483+
features: ['gen-ai-features', 'gen-ai-explore-traces'],
4484+
});
4485+
const promptsUpdateMock = MockApiClient.addMockResponse({
4486+
url: `/organizations/${organization.slug}/prompts-activity/`,
4487+
method: 'PUT',
4488+
});
44824489
MockApiClient.addMockResponse({
4483-
url: '/organizations/org-slug/seer/setup-check/',
4490+
url: `/organizations/${organization.slug}/seer/setup-check/`,
44844491
body: AutofixSetupFixture({
44854492
setupAcknowledgement: {
44864493
orgHasAcknowledged: false,
@@ -4489,21 +4496,15 @@ describe('SearchQueryBuilder', function () {
44894496
}),
44904497
});
44914498

4492-
const promptsUpdateMock = MockApiClient.addMockResponse({
4493-
url: `/organizations/${organization.slug}/prompts-activity/`,
4494-
method: 'PUT',
4495-
});
4496-
4497-
render(<SearchQueryBuilder {...defaultProps} enableAISearch />, {
4498-
organization: {features: ['gen-ai-features', 'gen-ai-explore-traces']},
4499-
});
4499+
render(<SearchQueryBuilder {...defaultProps} enableAISearch />, {organization});
45004500

45014501
await userEvent.click(getLastInput());
45024502

4503-
const enableAi = await screen.findByText(/Enable Gen AI/);
4503+
const enableAi = await screen.findByRole('option', {name: /Enable Gen AI/});
45044504
expect(enableAi).toBeInTheDocument();
45054505

4506-
await userEvent.click(enableAi);
4506+
await userEvent.hover(enableAi);
4507+
await userEvent.keyboard('{enter}');
45074508

45084509
await waitFor(() => {
45094510
expect(promptsUpdateMock).toHaveBeenCalledWith(

0 commit comments

Comments
 (0)