From affc666095e1b959db7c7b0e255ae05d3fd75937 Mon Sep 17 00:00:00 2001 From: BilalLiaquat7 Date: Sat, 9 Sep 2023 13:29:18 +0500 Subject: [PATCH 1/2] testing added for missions --- src/tests/Missions.test.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/tests/Missions.test.js diff --git a/src/tests/Missions.test.js b/src/tests/Missions.test.js new file mode 100644 index 0000000..199d318 --- /dev/null +++ b/src/tests/Missions.test.js @@ -0,0 +1,27 @@ +import React from 'react'; +import { render } from '@testing-library/react'; +import { useSelector } from 'react-redux'; +import Missions from '../pages/Missions/Missions'; + +jest.mock('react-redux'); + +jest.mock('axios', () => ({ + get: jest.fn(), +})); + +test('Rockets component renders correctly', () => { + useSelector.mockReturnValue({ + missions: [ + { + id: 1, + mission_name: 'Thaicom', + description: 'A powerful rocket developed by SpaceX.', + reserved: false, + }, + ], + }); + + const { container } = render(); + + expect(container).toMatchSnapshot(); +}); \ No newline at end of file From 2f2137bdc8f6dda4511cfbfcbb2cb787b250285b Mon Sep 17 00:00:00 2001 From: BilalLiaquat7 Date: Sat, 9 Sep 2023 13:32:51 +0500 Subject: [PATCH 2/2] linters fixed --- src/tests/Missions.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tests/Missions.test.js b/src/tests/Missions.test.js index 199d318..4df9f4e 100644 --- a/src/tests/Missions.test.js +++ b/src/tests/Missions.test.js @@ -24,4 +24,4 @@ test('Rockets component renders correctly', () => { const { container } = render(); expect(container).toMatchSnapshot(); -}); \ No newline at end of file +});