Skip to content

Commit

Permalink
test: format tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Vente16 committed Jan 2, 2024
1 parent 7abeacf commit 381cfd2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions plugins/communications-app/IndividualEmails/api.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ describe('getLearnersEmailInstructorTask', () => {
});
});

it('successfully fetches data', async () => {
test('successfully fetches data', async () => {
const data = await getLearnersEmailInstructorTask(mockCourseId, mockSearch);
expect(data).toEqual(mockResponseData);
expect(getAuthenticatedHttpClient().get).toHaveBeenCalledWith(
`http://localhost/platform-plugin-communications/${mockCourseId}/api/search_learners?query=${mockSearch}&page=1&page_size=10`,
);
});

it('handles an error', async () => {
test('handles an error', async () => {
getAuthenticatedHttpClient().get.mockRejectedValue(new Error('Network error'));

await expect(getLearnersEmailInstructorTask(mockCourseId, mockSearch)).rejects.toThrow('Network error');
Expand Down
12 changes: 6 additions & 6 deletions plugins/communications-app/IndividualEmails/index.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ describe('IndividualEmails Component', () => {
</IntlProvider>
);

it('renders the component without errors', () => {
test('renders the component without errors', () => {
render(
<IntlProviderWrapper>
<IndividualEmails />
</IntlProviderWrapper>,
);
});

it('displays the correct internationalized messages', () => {
test('displays the correct internationalized messages', () => {
render(
<IntlProviderWrapper>
<IndividualEmails emailList={mockEmailList} />
Expand All @@ -62,7 +62,7 @@ describe('IndividualEmails Component', () => {
expect(screen.getByTestId('learners-email-list-label')).toHaveTextContent(individualEmailsLabelLearnersListLabel.defaultMessage);
});

it('renders the component with main components ', () => {
test('renders the component with main components ', () => {
render(
<IntlProviderWrapper>
<IndividualEmails courseId="123" emailList={mockEmailList} />
Expand All @@ -78,7 +78,7 @@ describe('IndividualEmails Component', () => {
expect(emailListLabel).toBeInTheDocument();
});

it('should render two email chips', () => {
test('should render two email chips', () => {
render(
<IntlProviderWrapper>
<IndividualEmails courseId="123" emailList={mockEmailList} />
Expand All @@ -89,7 +89,7 @@ describe('IndividualEmails Component', () => {
expect(emailChips).toHaveLength(2);
});

it('triggers search on typing in search box', async () => {
test('triggers search on typing in search box', async () => {
const mockHandleEmailSelected = jest.fn();
const mockCourseId = 'course123';
render(
Expand All @@ -111,7 +111,7 @@ describe('IndividualEmails Component', () => {
});
});

it('invokes handleDeleteEmail when clicking on delete icons', () => {
test('invokes handleDeleteEmail when clicking on delete icons', () => {
const mockHandleDeleteEmail = jest.fn();
render(
<IntlProviderWrapper>
Expand Down

0 comments on commit 381cfd2

Please sign in to comment.