import React from 'react'; import get from 'lodash/get'; import { useDispatch, useSelector } from 'react-redux'; import CodeEditor from 'components/CodeEditor'; import { updateCollectionTests } from 'providers/ReduxStore/slices/collections'; import { saveCollectionSettings } from 'providers/ReduxStore/slices/collections/actions'; import { useTheme } from 'providers/Theme'; import StyledWrapper from './StyledWrapper'; import Button from 'ui/Button'; const Tests = ({ collection }) => { const dispatch = useDispatch(); const tests = collection.draft?.root ? get(collection, 'draft.root.request.tests', '') : get(collection, 'root.request.tests', ''); const { displayedTheme } = useTheme(); const preferences = useSelector((state) => state.app.preferences); const onEdit = (value) => { dispatch( updateCollectionTests({ tests: value, collectionUid: collection.uid }) ); }; const handleSave = () => dispatch(saveCollectionSettings(collection.uid)); return (
These tests will run any time a request in this collection is sent.
); }; export default Tests;