mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-03-10 17:43:51 +00:00
Ensured requests when loading visits are made in parallel for big dataset
This commit is contained in:
@@ -43,7 +43,7 @@ describe('<ShortUrlVisits />', () => {
|
||||
}
|
||||
});
|
||||
|
||||
it('Renders a preloader when visits are loading', () => {
|
||||
it('renders a preloader when visits are loading', () => {
|
||||
const wrapper = createComponent({ loading: true });
|
||||
const loadingMessage = wrapper.find(MutedMessage);
|
||||
|
||||
@@ -51,6 +51,14 @@ describe('<ShortUrlVisits />', () => {
|
||||
expect(loadingMessage.html()).toContain('Loading...');
|
||||
});
|
||||
|
||||
it('renders a warning when loading large amounts of visits', () => {
|
||||
const wrapper = createComponent({ loading: true, loadingLarge: true });
|
||||
const loadingMessage = wrapper.find(MutedMessage);
|
||||
|
||||
expect(loadingMessage).toHaveLength(1);
|
||||
expect(loadingMessage.html()).toContain('This is going to take a while... :S');
|
||||
});
|
||||
|
||||
it('renders an error message when visits could not be loaded', () => {
|
||||
const wrapper = createComponent({ loading: false, error: true });
|
||||
const errorMessage = wrapper.find(Card);
|
||||
|
||||
@@ -4,6 +4,7 @@ import reducer, {
|
||||
GET_SHORT_URL_VISITS_START,
|
||||
GET_SHORT_URL_VISITS_ERROR,
|
||||
GET_SHORT_URL_VISITS,
|
||||
GET_SHORT_URL_VISITS_LARGE,
|
||||
} from '../../../src/visits/reducers/shortUrlVisits';
|
||||
|
||||
describe('shortUrlVisitsReducer', () => {
|
||||
@@ -15,6 +16,13 @@ describe('shortUrlVisitsReducer', () => {
|
||||
expect(loading).toEqual(true);
|
||||
});
|
||||
|
||||
it('returns loadingLarge on GET_SHORT_URL_VISITS_LARGE', () => {
|
||||
const state = reducer({ loadingLarge: false }, { type: GET_SHORT_URL_VISITS_LARGE });
|
||||
const { loadingLarge } = state;
|
||||
|
||||
expect(loadingLarge).toEqual(true);
|
||||
});
|
||||
|
||||
it('stops loading and returns error on GET_SHORT_URL_VISITS_ERROR', () => {
|
||||
const state = reducer({ loading: true, error: false }, { type: GET_SHORT_URL_VISITS_ERROR });
|
||||
const { loading, error } = state;
|
||||
|
||||
Reference in New Issue
Block a user