Merge pull request #22 from edx/AU-337

test: AU-337 Unit tests for E.S.G. Actions
This commit is contained in:
Justin Lapierre
2021-11-02 12:45:42 -04:00
committed by GitHub
4 changed files with 73 additions and 1 deletions

View File

@@ -7,7 +7,7 @@ const createAction = createActionFactory(dataKey);
export const loadCourseMetadata = createAction('loadCourseMetadata');
export const loadOraMetadata = createAction('loadOraMetadata');
export const setGrading = createAction('setGrading');
export const setShowReview = createAction('setReview');
export const setShowReview = createAction('setShowReview');
export const toggleShowRubric = createAction('toggleShowRubric');
export default StrictDict({

View File

@@ -0,0 +1,22 @@
import actions, { dataKey } from './app';
import { testAction, testActionTypes } from './testUtils';
describe('actions', () => {
describe('action types', () => {
const actionTypes = [
actions.loadCourseMetadata,
actions.loadOraMetadata,
actions.setGrading,
actions.setShowReview,
actions.toggleShowRubric,
].map(action => action.toString());
testActionTypes(actionTypes, dataKey);
});
describe('app actions provided', () => {
test('loadCourseMetadata action', () => testAction(actions.loadCourseMetadata));
test('loadOraMetadata action', () => testAction(actions.loadOraMetadata));
test('setGrading action', () => testAction(actions.setGrading));
test('setShowReview action', () => testAction(actions.setShowReview));
test('toggleShowRubric action', () => testAction(actions.toggleShowRubric));
});
});

View File

@@ -0,0 +1,36 @@
import actions, { dataKey } from './grading';
import { testAction, testActionTypes } from './testUtils';
describe('actions', () => {
describe('action types', () => {
const actionTypes = [
actions.loadSubmission,
actions.preloadNext,
actions.loadNext,
actions.loadPrev,
actions.updateSelection,
actions.rubric.updateComment,
actions.rubric.updateCriterionPoints,
actions.rubric.updateCriterionComment,
actions.startGrading,
actions.setRubricFeedback,
actions.setCriterionFeedback,
actions.clearGrade,
].map(action => action.toString());
testActionTypes(actionTypes, dataKey);
});
describe('grading actions provided', () => {
test('loadSubmission action', () => testAction(actions.loadSubmission));
test('preloadNext action', () => testAction(actions.preloadNext));
test('loadNext action', () => testAction(actions.loadNext));
test('loadPrev action', () => testAction(actions.loadPrev));
test('updateSelection action', () => testAction(actions.updateSelection));
test('rubric updateComment action', () => testAction(actions.rubric.updateComment));
test('rubric updateCritrionPoints action', () => testAction(actions.rubric.updateCriterionPoints));
test('rubric updateCriterionComment action', () => testAction(actions.rubric.updateCriterionComment));
test('startGrading action', () => testAction(actions.startGrading));
test('setRubricFeedback action', () => testAction(actions.setRubricFeedback));
test('setCriterionFeedback action', () => testAction(actions.setCriterionFeedback));
test('clearGrade action', () => testAction(actions.clearGrade));
});
});

View File

@@ -0,0 +1,14 @@
import actions, { dataKey } from './submissions';
import { testAction, testActionTypes } from './testUtils';
describe('actions', () => {
describe('action types', () => {
const actionTypes = [
actions.loadList,
].map(action => action.toString());
testActionTypes(actionTypes, dataKey);
});
describe('submissionsactions provided', () => {
test('loadList action', () => testAction(actions.loadList));
});
});