chore: Fix loading state in the inbox settings page (#4926)
This commit is contained in:
parent
263b8240d3
commit
c0249a1b5b
12 changed files with 106 additions and 97 deletions
|
@ -1,4 +1,8 @@
|
|||
import { getLoadingStatus, setLoadingStatus } from '../api';
|
||||
import {
|
||||
getLoadingStatus,
|
||||
parseAPIErrorResponse,
|
||||
setLoadingStatus,
|
||||
} from '../api';
|
||||
|
||||
describe('#getLoadingStatus', () => {
|
||||
it('returns correct status', () => {
|
||||
|
@ -13,3 +17,23 @@ describe('#setLoadingStatus', () => {
|
|||
expect(state.fetchAPIloadingStatus).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#parseAPIErrorResponse', () => {
|
||||
it('returns correct values', () => {
|
||||
expect(
|
||||
parseAPIErrorResponse({
|
||||
response: { data: { message: 'Error Message [message]' } },
|
||||
})
|
||||
).toBe('Error Message [message]');
|
||||
|
||||
expect(
|
||||
parseAPIErrorResponse({
|
||||
response: { data: { error: 'Error Message [error]' } },
|
||||
})
|
||||
).toBe('Error Message [error]');
|
||||
|
||||
expect(parseAPIErrorResponse('Error: 422 Failed')).toBe(
|
||||
'Error: 422 Failed'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue