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';
|
2023-02-18 12:40:37 +03:00
|
|
|
import type { ShortUrl } from '../../../src/short-urls/data';
|
|
|
|
import type { Visit } from '../../../src/visits/types';
|
2020-08-27 18:56:48 +03:00
|
|
|
|
|
|
|
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
|
|
|
});
|
|
|
|
});
|