feat: Adding husky and update pre-push hook
testing linting husky
This commit is contained in:
committed by
leangseu-edx
parent
59d169e41f
commit
fde93273e3
4
.husky/pre-push
Executable file
4
.husky/pre-push
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
. "$(dirname "$0")/_/husky.sh"
|
||||
|
||||
npm run lint
|
||||
@@ -13,7 +13,6 @@
|
||||
"i18n_extract": "BABEL_ENV=i18n fedx-scripts babel src --quiet > /dev/null",
|
||||
"lint": "fedx-scripts eslint --ext .jsx,.js src/",
|
||||
"lint-fix": "fedx-scripts eslint --fix --ext .jsx,.js src/",
|
||||
"prepush": "npm run lint",
|
||||
"semantic-release": "semantic-release",
|
||||
"start": "fedx-scripts webpack-dev-server --progress",
|
||||
"test": "TZ=GMT fedx-scripts jest --coverage --passWithNoTests",
|
||||
@@ -77,7 +76,7 @@
|
||||
"enzyme-adapter-react-16": "^1.15.6",
|
||||
"es-check": "^6.0.0",
|
||||
"fetch-mock": "^9.11.0",
|
||||
"husky": "7.0.1",
|
||||
"husky": "^7.0.0",
|
||||
"identity-obj-proxy": "^3.0.0",
|
||||
"jest": "27.0.6",
|
||||
"react-dev-utils": "^11.0.4",
|
||||
|
||||
@@ -18,11 +18,11 @@ export const InfoPopover = ({ children }) => (
|
||||
trigger="focus"
|
||||
placement="auto"
|
||||
flip
|
||||
overlay={
|
||||
overlay={(
|
||||
<Popover className="overlay-help-popover">
|
||||
<PopoverContent>{children}</PopoverContent>
|
||||
</Popover>
|
||||
}
|
||||
)}
|
||||
>
|
||||
<IconButton
|
||||
className="criteria-help-icon"
|
||||
|
||||
@@ -3,15 +3,15 @@ import { shallow } from 'enzyme';
|
||||
|
||||
import actions from 'data/actions';
|
||||
import selectors from 'data/selectors';
|
||||
import {
|
||||
feedbackRequirement,
|
||||
gradeStatuses,
|
||||
} from 'data/services/lms/constants';
|
||||
import {
|
||||
CriterionFeedback,
|
||||
mapStateToProps,
|
||||
mapDispatchToProps,
|
||||
} from './CriterionFeedback';
|
||||
import {
|
||||
feedbackRequirement,
|
||||
gradeStatuses,
|
||||
} from 'data/services/lms/constants';
|
||||
|
||||
jest.mock('@edx/paragon', () => ({
|
||||
Form: {
|
||||
|
||||
@@ -92,9 +92,7 @@ describe('Radio Crition Container', () => {
|
||||
expect(el.isEmptyRender()).toEqual(false);
|
||||
const optionsEl = el.find('.criteria-option');
|
||||
expect(optionsEl.length).toEqual(props.config.options.length);
|
||||
optionsEl.forEach((optionEl) =>
|
||||
expect(optionEl.prop('disabled')).toEqual(false),
|
||||
);
|
||||
optionsEl.forEach((optionEl) => expect(optionEl.prop('disabled')).toEqual(false));
|
||||
});
|
||||
|
||||
test('is not grading (all options are disabled)', () => {
|
||||
@@ -104,9 +102,7 @@ describe('Radio Crition Container', () => {
|
||||
expect(el.isEmptyRender()).toEqual(false);
|
||||
const optionsEl = el.find('.criteria-option');
|
||||
expect(optionsEl.length).toEqual(props.config.options.length);
|
||||
optionsEl.forEach((optionEl) =>
|
||||
expect(optionEl.prop('disabled')).toEqual(true),
|
||||
);
|
||||
optionsEl.forEach((optionEl) => expect(optionEl.prop('disabled')).toEqual(true));
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
|
||||
import actions from 'data/actions';
|
||||
import selectors from 'data/selectors';
|
||||
import { ReviewCriterion, mapStateToProps } from './ReviewCriterion';
|
||||
|
||||
@@ -76,7 +75,7 @@ describe('Review Crition Container', () => {
|
||||
const optionsEl = el.find('.criteria-option');
|
||||
expect(optionsEl.length).toEqual(props.config.options.length);
|
||||
optionsEl.forEach((optionEl, i) => {
|
||||
let option = props.config.options[i];
|
||||
const option = props.config.options[i];
|
||||
expect(optionEl.key()).toEqual(option.name);
|
||||
expect(optionEl.find('.option-label').childAt(0).text()).toEqual(
|
||||
option.label,
|
||||
|
||||
@@ -5,45 +5,45 @@ import { connect } from 'react-redux';
|
||||
import { Form } from '@edx/paragon';
|
||||
|
||||
import selectors from 'data/selectors';
|
||||
import { gradeStatuses } from 'data/services/lms/constants';
|
||||
|
||||
import InfoPopover from 'components/InfoPopover';
|
||||
import RadioCriterion from './RadioCriterion';
|
||||
import CriterionFeedback from './CriterionFeedback';
|
||||
import ReviewCriterion from './ReviewCriterion';
|
||||
import { gradeStatuses } from 'data/services/lms/constants';
|
||||
|
||||
/**
|
||||
* <CriterionContainer />
|
||||
*/
|
||||
export class CriterionContainer extends React.Component {
|
||||
render() {
|
||||
const { config, isGrading, orderNum, gradeStatus } = this.props;
|
||||
return (
|
||||
<Form.Group>
|
||||
<Form.Label className="criteria-label">
|
||||
<span className="criteria-title">{config.prompt}</span>
|
||||
<InfoPopover>
|
||||
{config.options.map((option) => (
|
||||
<div key={option.name} className="help-popover-option">
|
||||
<strong>{option.label}</strong>
|
||||
<br />
|
||||
{option.explanation}
|
||||
</div>
|
||||
))}
|
||||
</InfoPopover>
|
||||
</Form.Label>
|
||||
<div className="rubric-criteria">
|
||||
{isGrading || gradeStatus === gradeStatuses.graded ? (
|
||||
<RadioCriterion orderNum={orderNum} isGrading={isGrading} />
|
||||
) : (
|
||||
<ReviewCriterion orderNum={orderNum} />
|
||||
)}
|
||||
</div>
|
||||
<CriterionFeedback orderNum={orderNum} isGrading={isGrading} />
|
||||
</Form.Group>
|
||||
);
|
||||
}
|
||||
}
|
||||
export const CriterionContainer = (props) => {
|
||||
const {
|
||||
config, isGrading, orderNum, gradeStatus,
|
||||
} = props;
|
||||
return (
|
||||
<Form.Group>
|
||||
<Form.Label className="criteria-label">
|
||||
<span className="criteria-title">{config.prompt}</span>
|
||||
<InfoPopover>
|
||||
{config.options.map((option) => (
|
||||
<div key={option.name} className="help-popover-option">
|
||||
<strong>{option.label}</strong>
|
||||
<br />
|
||||
{option.explanation}
|
||||
</div>
|
||||
))}
|
||||
</InfoPopover>
|
||||
</Form.Label>
|
||||
<div className="rubric-criteria">
|
||||
{isGrading || gradeStatus === gradeStatuses.graded ? (
|
||||
<RadioCriterion orderNum={orderNum} isGrading={isGrading} />
|
||||
) : (
|
||||
<ReviewCriterion orderNum={orderNum} />
|
||||
)}
|
||||
</div>
|
||||
<CriterionFeedback orderNum={orderNum} isGrading={isGrading} />
|
||||
</Form.Group>
|
||||
);
|
||||
};
|
||||
|
||||
CriterionContainer.defaultProps = {};
|
||||
|
||||
|
||||
@@ -2,9 +2,10 @@ import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
|
||||
import selectors from 'data/selectors';
|
||||
import { CriterionContainer, mapStateToProps } from '.';
|
||||
import { gradeStatuses } from 'data/services/lms/constants';
|
||||
|
||||
import { CriterionContainer, mapStateToProps } from '.';
|
||||
|
||||
jest.mock('components/InfoPopover', () => 'InfoPopover');
|
||||
jest.mock('./RadioCriterion', () => 'RadioCriterion');
|
||||
jest.mock('./CriterionFeedback', () => 'CriterionFeedback');
|
||||
|
||||
@@ -23,7 +23,13 @@ export class RubricFeedback extends React.Component {
|
||||
}
|
||||
|
||||
render() {
|
||||
const { isGrading, value, feedbackPrompt, config } = this.props;
|
||||
const {
|
||||
isGrading,
|
||||
value,
|
||||
feedbackPrompt,
|
||||
config,
|
||||
} = this.props;
|
||||
|
||||
if (config === feedbackRequirement.disabled) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -3,15 +3,16 @@ import { shallow } from 'enzyme';
|
||||
|
||||
import actions from 'data/actions';
|
||||
import selectors from 'data/selectors';
|
||||
import {
|
||||
feedbackRequirement,
|
||||
gradeStatuses,
|
||||
} from 'data/services/lms/constants';
|
||||
|
||||
import {
|
||||
RubricFeedback,
|
||||
mapDispatchToProps,
|
||||
mapStateToProps,
|
||||
} from './RubricFeedback';
|
||||
import {
|
||||
feedbackRequirement,
|
||||
gradeStatuses,
|
||||
} from 'data/services/lms/constants';
|
||||
|
||||
jest.mock('components/InfoPopover', () => 'InfoPopover');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user