mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-01 03:27:52 +00:00
chore: Fix loading state in the inbox settings page (#4926)
This commit is contained in:
@@ -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'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user