Skip to content

Commit 0a025c3

Browse files
committed
Added test for Context Tab
1 parent 0c13921 commit 0a025c3

File tree

3 files changed

+20
-7
lines changed

3 files changed

+20
-7
lines changed

__tests__/BottomTabs.test.tsx

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { Provider } from 'react-redux';
33
import '@testing-library/jest-dom';
44
import { render, screen, fireEvent, waitFor } from '@testing-library/react';
55
import BottomTabs from '../app/src/components/bottom/BottomTabs';
6+
import ContextManager from '../app/src/components/ContextAPIManager/ContextManager';
67
import store from '../app/src/redux/store';
78
import ComponentPanel from '../app/src/components/right/ComponentPanel';
89
import HTMLPanel from '../app/src/components/left/HTMLPanel';
@@ -25,8 +26,8 @@ describe('Bottom Panel Render Test', () => {
2526
});
2627
});
2728

28-
describe('invalid input test', () => {
29-
test('New Component should display correct warning on empty input', async () => {
29+
describe('Creation Panel', () => {
30+
test('should invalidate empty field in New Component name', async () => {
3031
render(
3132
<Provider store={store}>
3233
<ComponentPanel isThemeLight={null} />
@@ -42,7 +43,7 @@ describe('invalid input test', () => {
4243
});
4344
});
4445

45-
test('New Component should display correct warning when input contains symbols', async () => {
46+
test('should invalidate New Component name containing symbols', async () => {
4647
render(
4748
<Provider store={store}>
4849
<ComponentPanel isThemeLight={null} />
@@ -64,7 +65,7 @@ describe('invalid input test', () => {
6465
});
6566
});
6667

67-
test('html tag should display error if input is empty', async () => {
68+
test('should invalidate empty field in HTML Tag tag', async () => {
6869
render(
6970
<Provider store={store}>
7071
<HTMLPanel isThemeLight={null} />
@@ -78,7 +79,7 @@ describe('invalid input test', () => {
7879
});
7980
});
8081

81-
test('element name should display error if input starts with symbol', async () => {
82+
test('should invalidate HTML Element name containing symbols', async () => {
8283
render(
8384
<Provider store={store}>
8485
<HTMLPanel isThemeLight={null} />
@@ -106,3 +107,15 @@ describe('invalid input test', () => {
106107
});
107108
});
108109
});
110+
111+
describe('Context Manager', () => {
112+
test('should contain all buttons and input fields', () => {
113+
render(
114+
<Provider store={store}>
115+
<ContextManager />
116+
</Provider>
117+
);
118+
expect(screen.getAllByRole('textbox')).toHaveLength(2);
119+
expect(screen.getAllByRole('button')).toHaveLength(3);
120+
});
121+
});

app/src/components/ContextAPIManager/ContextManager.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useContext } from 'react';
1+
import React, { useContext } from 'react';
22
import { makeStyles } from '@mui/styles';
33
import Box from '@mui/material/Box';
44
import Tab from '@mui/material/Tab';

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
"dist-linux": "electron-builder --linux",
7878
"dist-windows": "electron-builder --windows",
7979
"dist-all": "npm run prod-build && electron-builder --mac --linux --windows",
80-
"test": "NODE_ENV=test jest --verbose",
80+
"test": "NODE_ENV=test jest --verbose --coverage",
8181
"server": "cross-env NODE_ENV=development nodemon server/server.ts",
8282
"start": "node server/server.ts"
8383
},

0 commit comments

Comments
 (0)