diff --git a/__tests__/api.test.ts b/__tests__/api.test.ts index 0f04b01..cee8ee8 100644 --- a/__tests__/api.test.ts +++ b/__tests__/api.test.ts @@ -7,11 +7,14 @@ jest.mock('axios'); const mockedAxios = axios as jest.Mocked; -it('fetches successfully data from an API', async () => { - const data = { data: { userId: 1, id: 1, title: 'mock title' } }; - mockedAxios.get.mockResolvedValue(data); +describe('api', () => { + it('fetches successfully data from an API', async () => { + const data = { data: { userId: 1, id: 1, title: 'mock title' } }; + mockedAxios.get.mockResolvedValue(data); - const result = await fetchData('https://jsonplaceholder.typicode.com/todos/1'); - expect(result).toEqual(data.data); - expect(mockedAxios.get).toHaveBeenCalledTimes(1); + const result = await fetchData('https://jsonplaceholder.typicode.com/todos/1'); + expect(result).toEqual(data.data); + expect(mockedAxios.get).toHaveBeenCalledTimes(1); + }); }); + diff --git a/__tests__/sum.test.ts b/__tests__/sum.test.ts index 8be66bf..2a295d5 100644 --- a/__tests__/sum.test.ts +++ b/__tests__/sum.test.ts @@ -1,6 +1,8 @@ import { test, expect } from '@jest/globals'; import { sum } from '../src/sum'; -test('adds 1 + 2 to equal 3', () => { - expect(sum(1, 2)).toBe(3); +describe('sum', () => { + test('adds 1 + 2 to equal 3', () => { + expect(sum(1, 2)).toBe(3); + }); });