Reinit project

This commit is contained in:
Limo Saplf
2019-08-31 20:44:15 +08:00
commit b51ae824c7
115 changed files with 20955 additions and 0 deletions

View File

@@ -0,0 +1 @@
export const formatMessage = (): string => 'Mock text';

View File

@@ -0,0 +1,21 @@
import 'jest';
import Index from '..';
import React from 'react';
import renderer, { ReactTestInstance, ReactTestRenderer } from 'react-test-renderer';
jest.mock('umi-plugin-locale');
describe('Page: index', () => {
it('Render correctly', () => {
const wrapper: ReactTestRenderer = renderer.create(<Index />);
expect(wrapper.root.children.length).toBe(1);
const outerLayer = wrapper.root.children[0] as ReactTestInstance;
expect(outerLayer.type).toBe('div');
expect(outerLayer.children.length).toBe(2);
const getStartLink = outerLayer.findAllByProps({
href: 'https://umijs.org/guide/getting-started.html',
}) as ReactTestInstance[];
expect(getStartLink.length).toBe(1);
expect(getStartLink[0].children).toMatchObject(['Mock text']);
});
});