Skip to content

Commit

Permalink
[MM-770]: removed extra comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Kshitij-Katiyar committed Sep 18, 2024
1 parent f8092fe commit 8505495
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 186 deletions.
183 changes: 0 additions & 183 deletions webapp/src/components/modals/create_issue/create_issue.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,186 +110,3 @@ describe('CreateIssueModal', () => {
expect(selectors).not.toBeNull();
});
});


























// import React from 'react';
// import { shallow } from 'enzyme';
// import CreateIssueModal from './create_issue';

// jest.mock('utils/user_utils', () => ({
// getErrorMessage: jest.fn(() => 'Error occurred'),
// }));

// describe('CreateIssueModal', () => {
// const defaultProps = {
// close: jest.fn(),
// create: jest.fn(() => Promise.resolve({})),
// post: null,
// title: '',
// channelId: '',
// theme: {
// centerChannelColor: '#000',
// centerChannelBg: '#fff'
// },
// visible: true,
// };

// it('should render correctly with default props', () => {
// const wrapper = shallow(<CreateIssueModal {...defaultProps} />);
// expect(wrapper).toMatchSnapshot();
// });

// it('should call close prop when handleClose is called', () => {
// const wrapper = shallow(<CreateIssueModal {...defaultProps} />);
// wrapper.instance().handleClose();
// expect(defaultProps.close).toHaveBeenCalled();
// });

// it('should call create prop when form is submitted with valid data', async () => {
// const wrapper = shallow(<CreateIssueModal {...defaultProps} />);
// wrapper.setState({ issueTitle: 'Test Issue' });

// await wrapper.instance().handleCreate({ preventDefault: () => {} });
// expect(defaultProps.create).toHaveBeenCalled();
// });

// it('should display error message when create returns an error', async () => {
// const errorProps = {
// ...defaultProps,
// create: jest.fn(() => Promise.resolve({ error: { message: 'Some error' } })),
// };

// const wrapper = shallow(<CreateIssueModal {...errorProps} />);
// wrapper.setState({ issueTitle: 'Test Issue' });

// await wrapper.instance().handleCreate({ preventDefault: () => {} });
// wrapper.update();

// expect(wrapper.find('.help-text.error-text').text()).toEqual('Error occurred');
// });
// });



///// IN ONE ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
















// import React from 'react';
// import { shallow } from 'enzyme';
// import CreateIssueModal from './create_issue';

// describe('CreateIssueModal', () => {
// const defaultProps = {
// close: jest.fn(),
// create: jest.fn(),
// post: { message: 'Post message' },
// title: 'Initial Title',
// channelId: 'channel-123',
// theme: {
// centerChannelColor: '#000',
// centerChannelBg: '#fff'
// },
// visible: true,
// };

// // it('should initialize state correctly from props', () => {
// // const wrapper = shallow(<CreateIssueModal {...defaultProps} />);
// // expect(wrapper.state('issueDescription')).toBe('Post message');
// // expect(wrapper.state('issueTitle')).toBe('Initial Title');
// // });

// // it('should update state when post prop changes', () => {
// // const wrapper = shallow(<CreateIssueModal {...defaultProps} />);
// // expect(wrapper.state('issueDescription')).toBe('Post message');

// // // Update props
// // wrapper.setProps({ post: { message: 'New post message' } });
// // wrapper.update(); // Force re-render to make sure `componentDidUpdate` runs
// // expect(wrapper.state('issueDescription')).toBe('New post message');
// // });

// it('should update state when channelId or title props change', () => {
// const wrapper = shallow(<CreateIssueModal {...defaultProps} />);
// expect(wrapper.state('issueTitle')).toBe('Initial Title');

// // Update props
// wrapper.setProps({ title: 'New Title', channelId: 'channel-456' });
// wrapper.update();
// expect(wrapper.state('issueTitle')).toBe('New Title');
// });
// });


//c -------------------------------------------------------



// import React from 'react';
// import { shallow } from 'enzyme';
// import CreateIssueModal from './create_issue';

// describe('CreateIssueModal', () => {
// let wrapper;
// const defaultProps = {
// close: jest.fn(),
// create: jest.fn(),
// post: null,
// title: '',
// channelId: '',
// theme: {
// centerChannelColor: '#000',
// centerChannelBg: '#fff'
// },
// visible: true,
// };

// beforeEach(() => {
// wrapper = shallow(<CreateIssueModal {...defaultProps} />);
// wrapper.setState({ repo: { name: 'test-repo', permissions: { push: true } } });
// wrapper.update();
// });

// it('should render issue attribute selectors when repo is selected', () => {
// expect(wrapper.find('GithubLabelSelector').exists()).toBe(true);
// // expect(wrapper.find('GithubAssigneeSelector').exists()).toBe(true);
// // expect(wrapper.find('GithubMilestoneSelector').exists()).toBe(true);
// });
// });
3 changes: 0 additions & 3 deletions webapp/tests/setup.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.

import Adapter from 'enzyme-adapter-react-16';
import {configure} from 'enzyme';

Expand Down

0 comments on commit 8505495

Please sign in to comment.