feat: Add AI Error Debugging using OpenAI (#8805)

This commit is contained in:
Alex Grozav
2024-03-13 16:48:00 +02:00
committed by GitHub
parent e3dd353ea7
commit 948c383999
26 changed files with 1838 additions and 362 deletions

View File

@@ -0,0 +1,48 @@
import { render, fireEvent } from '@testing-library/vue';
import Feedback from '@/components/Feedback.vue';
vi.mock('@/composables/useI18n', () => ({
useI18n: () => ({
baseText: (key: string) => key,
}),
}));
describe('Feedback', () => {
it('should emit update:modelValue event with positive feedback', async () => {
const { getByTestId, emitted } = render(Feedback);
await fireEvent.click(getByTestId('feedback-button-positive'));
expect(emitted()).toHaveProperty('update:modelValue');
expect(emitted()['update:modelValue'][0]).toEqual(['positive']);
});
it('should emit update:modelValue event with negative feedback', async () => {
const { getByTestId, emitted } = render(Feedback);
await fireEvent.click(getByTestId('feedback-button-negative'));
expect(emitted()).toHaveProperty('update:modelValue');
expect(emitted()['update:modelValue'][0]).toEqual(['negative']);
});
it('should display positive feedback message when modelValue is positive', () => {
const { getByText } = render(Feedback, {
props: {
modelValue: 'positive',
},
});
expect(getByText(/feedback.positive/i)).toBeInTheDocument();
});
it('should display negative feedback message when modelValue is negative', () => {
const { getByText } = render(Feedback, {
props: {
modelValue: 'negative',
},
});
expect(getByText(/feedback.negative/i)).toBeInTheDocument();
});
});