2020-08-27 18:56:48 +03:00
|
|
|
import { Mock } from 'ts-mockery';
|
2022-11-08 00:29:15 +03:00
|
|
|
import { createNewVisits } from '../../../src/visits/reducers/visitCreation';
|
2020-08-27 18:56:48 +03:00
|
|
|
import { ShortUrl } from '../../../src/short-urls/data';
|
|
|
|
import { Visit } from '../../../src/visits/types';
|
|
|
|
|
|
|
|
describe('visitCreationReducer', () => {
|
2020-09-12 12:31:44 +03:00
|
|
|
describe('createNewVisits', () => {
|
2020-08-27 18:56:48 +03:00
|
|
|
const shortUrl = Mock.all<ShortUrl>();
|
|
|
|
const visit = Mock.all<Visit>();
|
|
|
|
|
2022-03-26 14:17:42 +03:00
|
|
|
it('just returns the action with proper type', () => {
|
2022-11-05 15:01:00 +03:00
|
|
|
expect(createNewVisits([{ shortUrl, visit }])).toEqual({
|
2022-11-08 00:29:15 +03:00
|
|
|
type: createNewVisits.toString(),
|
2022-11-05 15:01:00 +03:00
|
|
|
payload: { createdVisits: [{ shortUrl, visit }] },
|
|
|
|
});
|
2022-03-26 14:17:42 +03:00
|
|
|
});
|
2020-08-27 18:56:48 +03:00
|
|
|
});
|
|
|
|
});
|