Skip to content

Commit

Permalink
fix the unit test issues
Browse files Browse the repository at this point in the history
  • Loading branch information
DawoudSheraz committed Jun 24, 2021
1 parent b6ca2e9 commit 0eb1f74
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/users/enrollments/Certificates.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default function Certificates({
const certificateRef = useRef(null);

useEffect(() => {
if (certificate === undefined || (courseId !== oldCourseId)) {
if ((certificate === undefined && !displayCertErrors) || (courseId !== oldCourseId)) {
getCertificate(username, courseId).then((result) => {
const camelCaseResult = camelCaseObject(result);
if (camelCaseResult.errors) {
Expand All @@ -40,7 +40,7 @@ export default function Certificates({
}
});
}
});
}, [certificate, courseId]);

useLayoutEffect(() => {
if (certificateRef != null) {
Expand Down
4 changes: 2 additions & 2 deletions src/users/enrollments/Certificates.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('Certificate component', () => {

const props = {
username: testUser,
courseKey: testCourseId,
courseId: testCourseId,
closeHandler: jest.fn(() => {}),
};

Expand Down Expand Up @@ -95,7 +95,7 @@ describe('Certificate component', () => {
expect(dataRows.at(4).find('td').at(1).text()).toEqual('Not Available');
});

it.skip('Certificate Fetch Errors', async () => {
it('Certificate Fetch Errors', async () => {
apiMock = jest.spyOn(api, 'getCertificate').mockImplementationOnce(() => Promise.resolve({
errors: [
{
Expand Down

0 comments on commit 0eb1f74

Please sign in to comment.