mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-03-10 17:43:51 +00:00
Created page for tag visit stats
This commit is contained in:
@@ -1,14 +1,13 @@
|
||||
import reducer, {
|
||||
getShortUrlVisits,
|
||||
cancelGetShortUrlVisits,
|
||||
createNewVisit,
|
||||
GET_SHORT_URL_VISITS_START,
|
||||
GET_SHORT_URL_VISITS_ERROR,
|
||||
GET_SHORT_URL_VISITS,
|
||||
GET_SHORT_URL_VISITS_LARGE,
|
||||
GET_SHORT_URL_VISITS_CANCEL,
|
||||
CREATE_SHORT_URL_VISIT,
|
||||
} from '../../../src/visits/reducers/shortUrlVisits';
|
||||
import { CREATE_VISIT } from '../../../src/visits/reducers/visitCreation';
|
||||
|
||||
describe('shortUrlVisitsReducer', () => {
|
||||
describe('reducer', () => {
|
||||
@@ -54,7 +53,7 @@ describe('shortUrlVisitsReducer', () => {
|
||||
it.each([
|
||||
[{ shortCode: 'abc123' }, [{}, {}, {}]],
|
||||
[{ shortCode: 'def456' }, [{}, {}]],
|
||||
])('appends a new visit on CREATE_SHORT_URL_VISIT', (state, expectedVisits) => {
|
||||
])('appends a new visit on CREATE_VISIT', (state, expectedVisits) => {
|
||||
const shortUrl = {
|
||||
shortCode: 'abc123',
|
||||
};
|
||||
@@ -63,7 +62,7 @@ describe('shortUrlVisitsReducer', () => {
|
||||
visits: [{}, {}],
|
||||
};
|
||||
|
||||
const { visits } = reducer(prevState, { type: CREATE_SHORT_URL_VISIT, shortUrl, visit: {} });
|
||||
const { visits } = reducer(prevState, { type: CREATE_VISIT, shortUrl, visit: {} });
|
||||
|
||||
expect(visits).toEqual(expectedVisits);
|
||||
});
|
||||
@@ -138,11 +137,4 @@ describe('shortUrlVisitsReducer', () => {
|
||||
it('just returns the action with proper type', () =>
|
||||
expect(cancelGetShortUrlVisits()).toEqual({ type: GET_SHORT_URL_VISITS_CANCEL }));
|
||||
});
|
||||
|
||||
describe('createNewVisit', () => {
|
||||
it('just returns the action with proper type', () =>
|
||||
expect(createNewVisit({ shortUrl: {}, visit: {} })).toEqual(
|
||||
{ type: CREATE_SHORT_URL_VISIT, shortUrl: {}, visit: {} }
|
||||
));
|
||||
});
|
||||
});
|
||||
|
||||
10
test/visits/reducers/visitCreation.test.js
Normal file
10
test/visits/reducers/visitCreation.test.js
Normal file
@@ -0,0 +1,10 @@
|
||||
import { CREATE_VISIT, createNewVisit } from '../../../src/visits/reducers/visitCreation';
|
||||
|
||||
describe('visitCreationReducer', () => {
|
||||
describe('createNewVisit', () => {
|
||||
it('just returns the action with proper type', () =>
|
||||
expect(createNewVisit({ shortUrl: {}, visit: {} })).toEqual(
|
||||
{ type: CREATE_VISIT, shortUrl: {}, visit: {} }
|
||||
));
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user