Skip to content

Commit 59eba74

Browse files
Anshuman SinhaAnshuman Sinha
authored andcommitted
merging most recent dev to test if test suite still passes fully
2 parents 9bd66d5 + 12cba98 commit 59eba74

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+1449
-1255
lines changed

README.md

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<h1 align="center" style="background-color: #5E17EB;">
2-
<a href="https://lapce.dev" target="_blank">
2+
<a href="https://jester.software" target="_blank">
33
<img
44
style="display: block;
55
margin-left: auto;
@@ -15,7 +15,7 @@
1515
<h3 align="center">Code Generator for Integration Tests</h3>
1616

1717
<div align="center">
18-
<a href="https://jester-app.dev" target="_blank">
18+
<a href="https://jester.software" target="_blank">
1919
<img src="https://img.shields.io/badge/website-jester-purple.svg" />
2020
</a>
2121
<img alt="license" src="https://img.shields.io/badge/License-MIT-green.svg">
@@ -24,13 +24,39 @@
2424
<br/>
2525

2626
## Introduction
27+
Welcome to **Jester**: An easy-to-use web application that helps you create and implement integration tests, to quickly build out a lightweight testing suite for your application.
2728

28-
## Get Started
29+
## Getting Started
30+
Please visit https://jester.software to get started.
2931

3032
## Licenses
33+
ISC
34+
35+
## How it Works
36+
Jester will pass inputs from a Graphical User Interface to a server that will perform algorithmic logic to generate integration test code. From here, Jester can save your query into a database and feed back a functional test for your project if you want to take advantage of our account functionality, or it can simply return the functional test code without saving it to a database.
37+
38+
## Features
39+
40+
**Logging In**
41+
You can use the application with limited functionality without creating an account and logging in; however, reccomend creating an account through GitHub oAuth for a secure and full experience.
42+
43+
**Creating a Test**
44+
To create a test, begin by selecting the type of HTTP method you would like to write test code for as well as the endpoint of your request. To begin adding assertions, click the purple '+' icon and add up to three assertions as needed for any Status Code, Content Type, or Response Body. Once all relevant information has been input, click on 'Generate Test code' and Jester will generate a functional integration test.
45+
46+
**Creating a Project**
47+
Logged in users are able to create a project inside of which generated test code snippets can be saved. You can generate test code using Jester and save it into a specific project utilizing the 'append to project' button.
48+
49+
<p align="center">
50+
<img src="client/assets/append-clipboard.gif" width="600px" margin="auto"/>
51+
</p>
52+
53+
This will help engineers stay organized while developing test suites for multiple projects.
54+
55+
**Viewing Your Saved Projects**
56+
To view all of the projects you have created, please utilize our vertical tool bar on the left side of the page. When you select 'Projects', a pop-out menu will display all the projects on your account. From here, you can select any of your projects to view the saved code snippets inside. If you haven't created a project, please create one from here or generate test code and append it to a project in order to begin.
3157

3258
## Contributing
33-
As an open source project, we are always open to contributors wanting to improve the library. For more information, please visit our [contributing documentation](https://github.com/oslabs-beta/d3no-data/blob/main/CONTRIBUTING.md).
59+
As an open source project, we are always open to contributors wanting to improve the library.
3460

3561
## Contributors
3662
<ul>
@@ -53,7 +79,7 @@ As an open source project, we are always open to contributors wanting to improve
5379
</a>
5480
</li>
5581
<li>
56-
Lilah September
82+
Lilah October
5783
<a href="https://www.linkedin.com/in/lilah-august-28a857243" target="_blank">
5884
<img src="https://img.shields.io/badge/LinkedIn-0077B5?style=social&logo=linkedin" />
5985
</a>
@@ -79,4 +105,10 @@ As an open source project, we are always open to contributors wanting to improve
79105
<img src="https://img.shields.io/badge/Github-0077B5?style=social&logo=github" />
80106
</a>
81107
</li>
82-
</ul>
108+
</ul>
109+
110+
## Documentation
111+
The Jester docs are available at https://jester.software/docs
112+
113+
## Resources
114+
Built using React, Redux Toolkit, and Typescript

__tests__/React Unit Testing/react.tsx

Lines changed: 26 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,19 @@ import userEvent from '@testing-library/user-event';
77

88
import { TestInputForm } from '../../client/components/TestInputForm';
99
import { ProjectDropdown } from '../../client/components/ProjectDropdown';
10-
import { setRequestType } from '../../client/redux/reducers/testFormSlice';
11-
1210

1311
import { RequestBody } from '../../client/components/RequestBody';
1412
import { DEFAULT_PROJECT } from '../../client/constants';
1513

16-
1714
describe('Unit testing "TestInputForm" component', () => {
18-
const initialState = {
15+
const initialState = {
1916
testForm: {
2017
requestType: 'Get',
2118
assertionList: {},
2219
i: 0,
2320
userInput: '',
2421
},
25-
userInfo: {
22+
userInfo: {
2623
projectsInfo: [
2724
{
2825
project_id: 0,
@@ -31,7 +28,8 @@ describe('Unit testing "TestInputForm" component', () => {
3128
showAccessClipboard: false,
3229
},
3330
],
34-
currentProject: DEFAULT_PROJECT }
31+
currentProject: DEFAULT_PROJECT,
32+
},
3533
};
3634

3735
const mockStore = configureStore();
@@ -56,24 +54,23 @@ describe('Unit testing "TestInputForm" component', () => {
5654
});
5755

5856
xtest('Dropdown menu for request type renders successfully', async () => {
59-
// const dropdown = screen.getByDisplayValue('Get');
60-
// console.log(dropdown)
61-
// expect(dropdown.type).toEqual('text');
62-
// const dropdown = document.querySelector('#request-selector')
63-
6457
userEvent.click(screen.getByRole('button', { name: 'Get' }));
6558
await (() => userEvent.click(screen.getByText(/Post/i)));
6659
expect(await screen.getByText('Post')).toBeInTheDocument();
6760
});
6861

6962
test('Add assertion button renders successfully', () => {
7063
expect(screen.getByText('+')).toBeInTheDocument();
71-
expect(screen.getByRole('button', { name : '+' })).toBeInTheDocument();
64+
expect(screen.getByRole('button', { name: '+' })).toBeInTheDocument();
7265
});
7366

7467
test('Endpoint textbox renders successfully', () => {
75-
expect(screen.getByRole('textbox', { name: 'Endpoint' })).toBeInTheDocument();
76-
expect(screen.getByRole('textbox', { name: 'Endpoint' }).id).toEqual('endpoint');
68+
expect(
69+
screen.getByRole('textbox', { name: 'Endpoint' })
70+
).toBeInTheDocument();
71+
expect(screen.getByRole('textbox', { name: 'Endpoint' }).id).toEqual(
72+
'endpoint'
73+
);
7774
});
7875

7976
xtest('Add button renders middle component', () => {
@@ -82,36 +79,34 @@ describe('Unit testing "TestInputForm" component', () => {
8279
expect(dropdown).toBeInTheDocument();
8380
const textbox = screen.getByLabelText('User Input');
8481
expect(textbox).toBeInTheDocument();
85-
expect(screen.getByRole('textbox', { name: 'User Input' })).toBeInTheDocument();
82+
expect(
83+
screen.getByRole('textbox', { name: 'User Input' })
84+
).toBeInTheDocument();
8685
const button = screen.getByText('-');
8786
expect(button).toBeInTheDocument();
8887
expect(screen.getByRole('textbox', { name: '-' })).toBeInTheDocument();
8988
});
9089

91-
// add button renders middle component
92-
9390
test('Dropdown menu for project renders successfully', async () => {
9491
render(
9592
<Provider store={store}>
9693
<ProjectDropdown />
9794
</Provider>
9895
);
99-
const dropdown = screen.getByRole('button', { name: 'Project One' });
96+
const dropdown = screen.getByRole('button', { name: 'Guest Project' });
10097
expect(dropdown).toBeInTheDocument();
10198
});
102-
103-
xtest('Generate Test Code button renders successfully', () => {
104-
// Is that for Lilah?
105-
});
10699
});
107100

108101
describe('Unit testing "RequestBody" component', () => {
109-
const initialState = { testForm: {
110-
requestType: 'Post',
111-
assertionList: {},
112-
i: 0,
113-
userInput: '',
114-
} };
102+
const initialState = {
103+
testForm: {
104+
requestType: 'Post',
105+
assertionList: {},
106+
i: 0,
107+
userInput: '',
108+
},
109+
};
115110

116111
const mockStore = configureStore();
117112
let store;
@@ -121,13 +116,14 @@ describe('Unit testing "RequestBody" component', () => {
121116
const state = store.getState();
122117
render(
123118
<Provider store={store}>
124-
<RequestBody showField = {state.testForm.requestType === 'Get' ? false : true} />
119+
<RequestBody
120+
showField={state.testForm.requestType === 'Get' ? false : true}
121+
/>
125122
</Provider>
126123
);
127124
});
128125

129126
test('Request body textbox renders successfully when requestType is Post, Patch, or Delete', () => {
130127
expect(screen.getByTestId('Request-Body')).toBeInTheDocument();
131128
});
132-
133129
});

__tests__/React Unit Testing/testCodeContainer.tsx

Lines changed: 28 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -4,85 +4,47 @@ import { Provider } from 'react-redux';
44
import configureStore from 'redux-mock-store';
55
import { fireEvent, render, screen } from '@testing-library/react';
66
import AddBoxIcon from '@mui/icons-material/AddBox';
7+
import ContentCopyIcon from '@mui/icons-material/ContentCopy';
78
import DoneAllIcon from '@mui/icons-material/DoneAll';
89

910
import CodeContainer from '../../client/containers/CodeContainer';
1011
import ButtonContainer from '../../client/containers/ButtonContainer';
1112
import AppButton from '../../client/components/AppButton';
1213

13-
1414
const initialState = {
15-
slice: {
15+
code: {
1616
codeOutput: 'describe(\'Sample description\')',
1717
},
1818
userInfo: {
1919
currentProjectId: 0,
2020
},
2121
};
2222

23-
const clickedState = {
24-
slice: {
25-
doneIcon: true,
26-
},
27-
userInfo: {
28-
currentProjectId: 0,
29-
},
30-
31-
};
32-
3323
const mockStore = configureStore();
3424

3525
const code = () => {
3626
render(
37-
<Provider store={ mockStore(initialState) }>
27+
<Provider store={mockStore(initialState)}>
3828
<CodeContainer />
3929
</Provider>
4030
);
4131
};
4232

4333
const button = () => {
4434
render(
45-
<Provider store={ mockStore(initialState) }>
35+
<Provider store={mockStore(initialState)}>
4636
<ButtonContainer />
4737
</Provider>
4838
);
4939
};
5040

51-
const props = {
52-
start: <AddBoxIcon/>,
53-
end : <DoneAllIcon/>,
54-
onClick: jest.fn(),
55-
testId: 'bttn-append',
56-
};
57-
58-
const appButton = () => {
59-
render(
60-
<AppButton
61-
{ ...props }
62-
/>
63-
);
64-
};
65-
66-
const buttonDone = () => {
67-
render(
68-
<Provider store={ mockStore(clickedState) }>
69-
<ButtonContainer/>
70-
</Provider>,
71-
);
72-
};
73-
7441
describe('Unit testing output Code Container components', () => {
75-
beforeAll(() => {
76-
// button();
77-
// const buttons = screen.getAllByRole('button');
78-
});
79-
8042
test('Renders placeholder code output in Code Container', () => {
8143
code();
8244
const codeOutput = screen.getByLabelText('Testing Code');
8345
expect(codeOutput.innerHTML).toEqual('describe(\'Sample description\')');
8446
});
85-
47+
8648
test('Renders two buttons', () => {
8749
button();
8850
expect(screen.getAllByRole('button')).toHaveLength(2);
@@ -100,9 +62,18 @@ describe('Unit testing output Code Container components', () => {
10062
expect(icon).toBeTruthy();
10163
});
10264

103-
test('Renders DoneAllIcon on state change', () => {
104-
buttonDone();
105-
const bttn = screen.getByTestId('bttn-copy');
65+
test('Renders DoneAllIcon on button click', () => {
66+
const props = {
67+
start: <ContentCopyIcon />,
68+
end: <DoneAllIcon />,
69+
onClick: jest.fn(),
70+
testId: 'bttn-copy',
71+
};
72+
render(<AppButton {...props} />);
73+
74+
let bttn = screen.getByTestId('bttn-copy');
75+
fireEvent.click(bttn);
76+
bttn = screen.getByTestId('bttn-copy');
10677
const icon = bttn.innerHTML.includes('data-testid="DoneAllIcon"');
10778
expect(icon).toBeTruthy();
10879
});
@@ -118,14 +89,21 @@ describe('Unit testing output Code Container components', () => {
11889
const icon = bttn.innerHTML.includes('data-testid="AddBoxIcon"');
11990
expect(icon).toBeTruthy();
12091
});
121-
122-
test('Append clipboard button OnClick renders DoneAllIcon and fires onClick function', () => {
123-
appButton();
92+
93+
test('Append clipboard button onClick renders DoneAllIcon and fires onClick function', () => {
94+
const props = {
95+
start: <AddBoxIcon />,
96+
end: <DoneAllIcon />,
97+
onClick: jest.fn(),
98+
testId: 'bttn-append',
99+
};
100+
render(<AppButton {...props} />);
101+
124102
let bttn = screen.getByRole('button', { name: '' });
125103
fireEvent.click(bttn);
126104
bttn = screen.getByRole('button', { name: '' });
127105
const icon = bttn.innerHTML.includes('data-testid="DoneAllIcon"');
128106
expect(icon).toBeTruthy();
129107
expect(props.onClick).toHaveBeenCalled();
130108
});
131-
});
109+
});

__tests__/React Unit Testing/testLogin.tsx

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,15 @@
11
import React from 'React';
22
import { Provider } from 'react-redux';
33
import configureStore from 'redux-mock-store';
4-
import { fireEvent, render, screen } from '@testing-library/react';
5-
import userEvent from '@testing-library/user-event';
4+
import { render, screen } from '@testing-library/react';
65
import '@testing-library/jest-dom';
76

87
import { Login } from '../../client/components/Login';
9-
import { AnyListenerPredicate } from '@reduxjs/toolkit';
108

119
const initialState = {};
1210

1311
const mockStore: any = configureStore();
1412

15-
const login = () => {
16-
render(
17-
<Provider store={mockStore(initialState)}>
18-
<Login open={true} />
19-
</Provider>
20-
);
21-
};
22-
2313
describe('Unit testing Login component', () => {
2414
beforeEach(() => {
2515
render(

0 commit comments

Comments
 (0)