fix: Don't force unread view to only discussions (#149)
Allow using the unread filter with questions.
This commit is contained in:
@@ -8,6 +8,7 @@ import { initializeStore } from '../store';
|
||||
import { executeThunk } from '../test-utils';
|
||||
import { getBlocksAPIResponse } from './__factories__';
|
||||
import { blocksAPIURL } from './api';
|
||||
import { RequestStatus } from './constants';
|
||||
import { fetchCourseBlocks } from './thunks';
|
||||
|
||||
const courseId = 'course-v1:edX+DemoX+Demo_Course';
|
||||
@@ -35,7 +36,7 @@ describe('Course blocks data layer tests', () => {
|
||||
axiosMock.reset();
|
||||
});
|
||||
|
||||
test('successfully processes block data', async () => {
|
||||
it('successfully processes block data', async () => {
|
||||
axiosMock.onGet(blocksAPIURL)
|
||||
.reply(200, getBlocksAPIResponse());
|
||||
|
||||
@@ -77,4 +78,29 @@ describe('Course blocks data layer tests', () => {
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
it('handles network error', async () => {
|
||||
axiosMock.onGet(blocksAPIURL).networkError();
|
||||
|
||||
await executeThunk(fetchCourseBlocks(courseId, 'test-user'), store.dispatch, store.getState);
|
||||
|
||||
expect(store.getState().blocks.status)
|
||||
.toBe(RequestStatus.FAILED);
|
||||
});
|
||||
it('handles network timeout', async () => {
|
||||
axiosMock.onGet(blocksAPIURL).timeout();
|
||||
|
||||
await executeThunk(fetchCourseBlocks(courseId, 'test-user'), store.dispatch, store.getState);
|
||||
|
||||
expect(store.getState().blocks.status)
|
||||
.toBe(RequestStatus.FAILED);
|
||||
});
|
||||
it('handles access denied', async () => {
|
||||
axiosMock.onGet(blocksAPIURL).reply(403, {});
|
||||
|
||||
await executeThunk(fetchCourseBlocks(courseId, 'test-user'), store.dispatch, store.getState);
|
||||
|
||||
expect(store.getState().blocks.status)
|
||||
.toBe(RequestStatus.DENIED);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user