mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-03-03 06:11:48 +00:00
Updated to stryker v4
This commit is contained in:
@@ -82,7 +82,7 @@ describe('selectedServerReducer', () => {
|
||||
it('dispatches error when health endpoint fails', async () => {
|
||||
const id = uuid();
|
||||
const getState = createGetStateMock(id);
|
||||
const expectedSelectedServer: NonReachableServer = { ...selectedServer, serverNotReachable: true };
|
||||
const expectedSelectedServer = Mock.of<NonReachableServer>({ ...selectedServer, serverNotReachable: true });
|
||||
|
||||
apiClientMock.health.mockRejectedValue({});
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { Mock } from 'ts-mockery';
|
||||
import { CsvJson } from 'csvjson';
|
||||
import ServersImporter from '../../../src/servers/services/ServersImporter';
|
||||
import { RegularServer } from '../../../src/servers/data';
|
||||
|
||||
describe('ServersImporter', () => {
|
||||
const servers: RegularServer[] = [ Mock.all<RegularServer>(), Mock.all<RegularServer>() ];
|
||||
const csvjsonMock = {
|
||||
toObject: jest.fn().mockReturnValue(servers),
|
||||
};
|
||||
const toObject = jest.fn().mockReturnValue(servers);
|
||||
const csvjsonMock = Mock.of<CsvJson>({ toObject });
|
||||
const readAsText = jest.fn();
|
||||
const fileReaderMock = Mock.of<FileReader>({
|
||||
readAsText,
|
||||
@@ -33,7 +33,7 @@ describe('ServersImporter', () => {
|
||||
await importer.importServersFromFile(Mock.of<File>({ type: 'text/csv' }));
|
||||
|
||||
expect(readAsText).toHaveBeenCalledTimes(1);
|
||||
expect(csvjsonMock.toObject).toHaveBeenCalledTimes(1);
|
||||
expect(toObject).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -37,7 +37,7 @@ describe('shortUrlMetaReducer', () => {
|
||||
});
|
||||
|
||||
it('returns provided tags and shortCode on SHORT_URL_META_EDITED', () => {
|
||||
expect(reducer(undefined, { type: SHORT_URL_META_EDITED, meta, shortCode })).toEqual({
|
||||
expect(reducer(undefined, { type: SHORT_URL_META_EDITED, meta, shortCode } as any)).toEqual({
|
||||
meta,
|
||||
shortCode,
|
||||
saving: false,
|
||||
|
||||
@@ -43,7 +43,7 @@ describe('tagDeleteReducer', () => {
|
||||
});
|
||||
|
||||
describe('deleteTag', () => {
|
||||
const createApiClientMock = (result: Promise<void>) => Mock.of<ShlinkApiClient>({
|
||||
const createApiClientMock = (result: Promise<any>) => Mock.of<ShlinkApiClient>({
|
||||
deleteTags: jest.fn(async () => result),
|
||||
});
|
||||
const dispatch = jest.fn();
|
||||
|
||||
@@ -57,7 +57,7 @@ describe('tagEditReducer', () => {
|
||||
});
|
||||
|
||||
describe('editTag', () => {
|
||||
const createApiClientMock = (result: Promise<void>) => Mock.of<ShlinkApiClient>({
|
||||
const createApiClientMock = (result: Promise<any>) => Mock.of<ShlinkApiClient>({
|
||||
editTag: jest.fn(async () => result),
|
||||
});
|
||||
const colorGenerator = Mock.of<ColorGenerator>({
|
||||
|
||||
@@ -35,7 +35,7 @@ describe('ShlinkApiClient', () => {
|
||||
|
||||
it('returns create short URL', async () => {
|
||||
const { createShortUrl } = createApiClient({ data: shortUrl });
|
||||
const result = await createShortUrl({});
|
||||
const result = await createShortUrl({ longUrl: '' });
|
||||
|
||||
expect(result).toEqual(shortUrl);
|
||||
});
|
||||
@@ -45,10 +45,11 @@ describe('ShlinkApiClient', () => {
|
||||
const { createShortUrl } = new ShlinkApiClient(axiosSpy, '', '');
|
||||
|
||||
await createShortUrl(
|
||||
{ foo: 'bar', empty: undefined, anotherEmpty: null },
|
||||
// @ts-expect-error
|
||||
{ longUrl: 'bar', customSlug: undefined, maxVisits: null },
|
||||
);
|
||||
|
||||
expect(axiosSpy).toHaveBeenCalledWith(expect.objectContaining({ data: { foo: 'bar' } }));
|
||||
expect(axiosSpy).toHaveBeenCalledWith(expect.objectContaining({ data: { longUrl: 'bar' } }));
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ describe('utils', () => {
|
||||
});
|
||||
|
||||
describe('rangeOf', () => {
|
||||
const func = (i) => `result_${i}`;
|
||||
const func = (i: number) => `result_${i}`;
|
||||
const size = 5;
|
||||
|
||||
it('builds a range of specified size invike provided function', () => {
|
||||
|
||||
Reference in New Issue
Block a user