Files
frontend-app-ora-grading/src/components/StatusBadge.test.jsx
Syed Ali Abbas Zaidi 5bed90b659 feat: migrate enzyme to edx/react-unit-test-utils (#295)
* feat: migrate enzyme to edx/react-unit-test-utils

* refactor: remove shallowWrapper usage

* refactor: remove unnecessary _instance usage
2024-02-10 00:35:02 +05:00

36 lines
1.4 KiB
JavaScript

import React from 'react';
import { shallow } from '@edx/react-unit-test-utils';
import { gradingStatuses } from 'data/services/lms/constants';
import { StatusBadge } from './StatusBadge';
const className = 'test-className';
describe('StatusBadge component', () => {
const render = (status) => shallow(<StatusBadge className={className} status={status} />);
describe('behavior', () => {
it('does not render if status does not have configured variant', () => {
const el = render('arbitrary');
expect(el.snapshot).toMatchSnapshot();
expect(el.isEmptyRender()).toEqual(true);
});
describe('status snapshots: loads badge with configured variant and message.', () => {
test('`ungraded` shows primary button variant and message', () => {
const el = render(gradingStatuses.ungraded);
expect(el.snapshot).toMatchSnapshot();
});
test('`locked` shows light button variant and message', () => {
const el = render(gradingStatuses.locked);
expect(el.snapshot).toMatchSnapshot();
});
test('`graded` shows success button variant and message', () => {
const el = render(gradingStatuses.graded);
expect(el.snapshot).toMatchSnapshot();
});
test('`inProgress` shows warning button variant and message', () => {
const el = render(gradingStatuses.inProgress);
expect(el.snapshot).toMatchSnapshot();
});
});
});
});