* move GradesTab and BulkHistoryTab to views and control from container through redux * add data logic for view control and import success toast * add NetworkButton component for download/upload buttons * remove download button from Bulk History view and update heading and help text * add View control button to GradebookHeader if bulk management available * remove FilterMenuToggle from SearchControls * update BulkManagementControls to now include upload/download grades buttons * add Import Success toast * rename UserLabel to FilteredUsersLabel for clarity * add InterventionsReport component * update GradesView top-level component * messageing update (separate messages into per-component files) * style updates * update test plan * clean up css and add docstrings * typo fix * fix typo in bulk management view header
47 lines
1.4 KiB
JavaScript
47 lines
1.4 KiB
JavaScript
import React from 'react';
|
|
import { shallow } from 'enzyme';
|
|
|
|
import selectors from 'data/selectors';
|
|
import { UsersLabel, mapStateToProps } from './UsersLabel';
|
|
|
|
jest.mock('@edx/paragon', () => ({
|
|
Icon: () => 'Icon',
|
|
}));
|
|
jest.mock('data/selectors', () => ({
|
|
__esModule: true,
|
|
default: {
|
|
grades: {
|
|
filteredUsersCount: state => ({ filteredUsersCount: state }),
|
|
totalUsersCount: state => ({ totalUsersCount: state }),
|
|
},
|
|
},
|
|
}));
|
|
|
|
describe('UsersLabel', () => {
|
|
describe('component', () => {
|
|
const props = {
|
|
filteredUsersCount: 23,
|
|
totalUsersCount: 140,
|
|
};
|
|
it('does not render if totalUsersCount is falsey', () => {
|
|
expect(shallow(<UsersLabel {...props} totalUsersCount={0} />)).toEqual({});
|
|
});
|
|
test('snapshot - displays label with number of filtered users out of total', () => {
|
|
expect(shallow(<UsersLabel {...props} />)).toMatchSnapshot();
|
|
});
|
|
});
|
|
describe('mapStateToProps', () => {
|
|
const testState = { a: 'nice', day: 'for', some: 'rain' };
|
|
let mapped;
|
|
beforeEach(() => {
|
|
mapped = mapStateToProps(testState);
|
|
});
|
|
test('filteredUsersCount from grades.filteredUsersCount', () => {
|
|
expect(mapped.filteredUsersCount).toEqual(selectors.grades.filteredUsersCount(testState));
|
|
});
|
|
test('totalUsersCount from grades.totalUsersCount', () => {
|
|
expect(mapped.totalUsersCount).toEqual(selectors.grades.totalUsersCount(testState));
|
|
});
|
|
});
|
|
});
|