docbrown/app/javascript/chat/__tests__/modFaqSection.test.jsx
narender2031 e78a0078a7
[deploy] Refactor 🚀 : Replaced Chat Channel Setting page with Preact component. (#8271)
* Feature 🚀 : Ability to delete messages in chat channels

- Sending message ID to frontend
- Deleting Message
- Use pusher to delete message realtime

* Minor Bug 🐞: Show message action only for current user

- User can delete or edit their own messages

* Test cases added

* Bug 🐞: Update message id for receiver

Message id was not sent to receiver by pusher

* Refactoring🛠: Message controller refactoring

* Test Cases📝 : Specs for Delete message added

* Feature 🚀 : Ability to edit messages

* Test Cases📝 : Specs for Edit message added

* 🐞 Channel List bug in mobile view

* changes in joining request responses

* 🛠  Request Managers Frontend ready

* changes in routes for adding and removing remembership

* 🚀 New routes implemented for request manager

* fix issues

* changes in api for remove membership

* Merge conflict resolved

* 🐞 Channel List bug in mobile view

* changes in joining request responses

* 🛠  Request Managers Frontend ready

* changes in routes for adding and removing remembership

* 🚀 New routes implemented for request manager

* fix issues

* changes in api for remove membership

* 🛠Optimizing for CodeClimate

* 🛠Optimizing again for CodeClimate

* 🛠Optimizing again 2 for CodeClimate

* 🛠 Added more test cases

* 🛠 Optimizing code

* 🚀 Action to open setting page added

* 🛠  Dummy page added for chat setting

* add JSON routes for chat channel settings

* Integrate chat channel settings API with UI

* 🐞 Channel List bug in mobile view

* 🛠  Request Managers Frontend ready

* changes in routes for adding and removing remembership

* 🚀 New routes implemented for request manager

* fix issues

* 🐞 Channel List bug in mobile view

* 🛠  Request Managers Frontend ready

* changes in routes for adding and removing remembership

* 🚀 New routes implemented for request manager

* fix issues

* 🛠Optimizing again for CodeClimate

* 🚀 Action to open setting page added

* 🛠  Dummy page added for chat setting

* add JSON routes for chat channel settings

* Integrate chat channel settings API with UI

* Fix PR requested changes

* Add JSDoc documentation to exported functions

* fix/add rspec test cases

* refactor channelSettinngs render part

* add test cases for chat channel settings component

* fix code-climate

* add rest component tests

* add more test coverage

* fix code-climate bugs

* add API function test

Co-authored-by: Sarthak Sharma <7lovesharma7@gmail.com>
Co-authored-by: Parasgr-code <paras.gaur@skynox.tech>
2020-06-10 16:58:37 -04:00

49 lines
1.3 KiB
JavaScript

import { h } from 'preact';
import render from 'preact-render-to-json';
import { shallow } from 'preact-render-spy';
import ModFaqSection from '../ChatChannelSettings/ModFaqSection';
const data = {
currentMembershipRole: 'mod',
};
const memberUser = {
currentMembershipRole: 'member',
};
const getModFaqSection = (resource) => {
return (
<ModFaqSection currentMembershipRole={resource.currentMembershipRole} />
);
};
describe('<ChannelDescriptionSection />', () => {
it('should render and test snapshot', () => {
const tree = render(getModFaqSection(data));
expect(tree).toMatchSnapshot();
});
it('should render the the component', () => {
const context = shallow(getModFaqSection(data));
expect(context.find('.faq-section').exists()).toEqual(true);
});
it('should have the contact details', () => {
const context = shallow(getModFaqSection(data));
expect(context.find('.contact-details').exists()).toEqual(true);
});
it('should render the same link text', () => {
const context = shallow(getModFaqSection(data));
expect(context.find('.url-link').text()).toEqual('yo@dev.to');
});
it('should not render the element', () => {
const context = shallow(getModFaqSection(memberUser));
expect(context.find('.faq-section').exists()).toEqual(false);
});
});