Skip to content

Commit

Permalink
fix: fixed some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
PKulkoRaccoonGang committed Oct 20, 2024
1 parent d757a99 commit 4ed52ac
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/data/selectors.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// eslint-disable-next-line import/prefer-default-export
export const getWaffleFlags = (state) => state.courseDetail.waffleFlags;
export const getWaffleFlags = (state) => state.courseDetail?.waffleFlags;
9 changes: 4 additions & 5 deletions src/data/thunks.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,10 @@ export function fetchWaffleFlags(courseId) {
dispatch(updateStatus({ courseId, status: RequestStatus.SUCCESSFUL }));
dispatch(fetchWaffleFlagsSuccess({ waffleFlags }));

Check warning on line 40 in src/data/thunks.js

View check run for this annotation

Codecov / codecov/patch

src/data/thunks.js#L39-L40

Added lines #L39 - L40 were not covered by tests
} catch (error) {
if (error.response && error.response.status === 404) {
dispatch(updateStatus({ courseId, status: RequestStatus.NOT_FOUND }));
} else {
dispatch(updateStatus({ courseId, status: RequestStatus.FAILED }));
}
// If fetching the waffle flags is unsuccessful,
// the pages will still be accessible and display without any issues.
// eslint-disable-next-line no-console
console.error({ courseId, status: RequestStatus.NOT_FOUND });
}
};
}

0 comments on commit 4ed52ac

Please sign in to comment.