1
0
mirror of https://github.com/SomboChea/ui synced 2024-11-16 03:04:27 +07:00

fix: improve jest mock typings

This commit is contained in:
Antoine Chalifour 2019-10-03 13:23:11 +02:00 committed by antoinechalifour
parent b1804d7644
commit 852f6eeb22
3 changed files with 3 additions and 11 deletions

View File

@ -2,7 +2,7 @@ import React from 'react';
import { mount } from 'enzyme'; import { mount } from 'enzyme';
import { ActionBar } from './ActionBar'; import { ActionBar } from './ActionBar';
const mockPackageMeta = jest.fn(() => ({ const mockPackageMeta: jest.Mock = jest.fn(() => ({
latest: { latest: {
homepage: 'https://verdaccio.tld', homepage: 'https://verdaccio.tld',
bugs: { bugs: {
@ -32,7 +32,6 @@ describe('<ActionBar /> component', () => {
}); });
test('when there is no action bar data', () => { test('when there is no action bar data', () => {
// @ts-ignore
mockPackageMeta.mockImplementation(() => ({ mockPackageMeta.mockImplementation(() => ({
latest: {}, latest: {},
})); }));
@ -44,7 +43,6 @@ describe('<ActionBar /> component', () => {
}); });
test('when there is a button to download a tarball', () => { test('when there is a button to download a tarball', () => {
// @ts-ignore
mockPackageMeta.mockImplementation(() => ({ mockPackageMeta.mockImplementation(() => ({
latest: { latest: {
dist: { dist: {

View File

@ -5,7 +5,7 @@ import Engine from './Engines';
jest.mock('./img/node.png', () => ''); jest.mock('./img/node.png', () => '');
jest.mock('../Install/img/npm.svg', () => ''); jest.mock('../Install/img/npm.svg', () => '');
const mockPackageMeta = jest.fn(() => ({ const mockPackageMeta: jest.Mock = jest.fn(() => ({
latest: { latest: {
homepage: 'https://verdaccio.tld', homepage: 'https://verdaccio.tld',
bugs: { bugs: {
@ -38,7 +38,6 @@ describe('<Engines /> component', () => {
}, },
}; };
// @ts-ignore
mockPackageMeta.mockImplementation(() => packageMeta); mockPackageMeta.mockImplementation(() => packageMeta);
const wrapper = mount(<Engine />); const wrapper = mount(<Engine />);
@ -50,7 +49,6 @@ describe('<Engines /> component', () => {
latest: {}, latest: {},
}; };
// @ts-ignore
mockPackageMeta.mockImplementation(() => packageMeta); mockPackageMeta.mockImplementation(() => packageMeta);
const wrapper = mount(<Engine />); const wrapper = mount(<Engine />);
@ -64,7 +62,6 @@ describe('<Engines /> component', () => {
}, },
}; };
// @ts-ignore
mockPackageMeta.mockImplementation(() => packageMeta); mockPackageMeta.mockImplementation(() => packageMeta);
const wrapper = mount(<Engine />); const wrapper = mount(<Engine />);

View File

@ -4,7 +4,7 @@ import Repository from './Repository';
jest.mock('./img/git.png', () => ''); jest.mock('./img/git.png', () => '');
const mockPackageMeta = jest.fn(() => ({ const mockPackageMeta: jest.Mock = jest.fn(() => ({
latest: { latest: {
homepage: 'https://verdaccio.tld', homepage: 'https://verdaccio.tld',
bugs: { bugs: {
@ -37,7 +37,6 @@ describe('<Repository /> component', () => {
}, },
}; };
// @ts-ignore
mockPackageMeta.mockImplementation(() => packageMeta); mockPackageMeta.mockImplementation(() => packageMeta);
const wrapper = mount(<Repository />); const wrapper = mount(<Repository />);
@ -49,7 +48,6 @@ describe('<Repository /> component', () => {
latest: {}, latest: {},
}; };
// @ts-ignore
mockPackageMeta.mockImplementation(() => packageMeta); mockPackageMeta.mockImplementation(() => packageMeta);
const wrapper = mount(<Repository />); const wrapper = mount(<Repository />);
@ -66,7 +64,6 @@ describe('<Repository /> component', () => {
}, },
}; };
// @ts-ignore
mockPackageMeta.mockImplementation(() => packageMeta); mockPackageMeta.mockImplementation(() => packageMeta);
const wrapper = mount(<Repository />); const wrapper = mount(<Repository />);