Browse Source

chore: solve test fail issue (#10939)

* feat: solve test fail

* feat: solve test fail

* feat: solve test fail

* feat: solve test fail

* chore: lint
pull/10966/head
kiner-tang(文辉) 3 years ago
committed by GitHub
parent
commit
b2882d3561
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      .github/workflows/ci.yml
  2. 1
      jest.config.ts
  3. 2
      package.json
  4. 11432
      pnpm-lock.yaml
  5. 2
      src/global.style.ts
  6. 1
      src/pages/account/center/_mock.ts
  7. 1
      src/pages/account/settings/_mock.ts
  8. 1
      src/pages/dashboard/analysis/components/Charts/ChartCard/index.tsx
  9. 1
      src/pages/form/advanced-form/_mock.ts
  10. 1
      src/pages/form/basic-form/_mock.ts
  11. 1
      src/pages/form/step-form/_mock.ts
  12. 1
      src/pages/list/basic-list/_mock.ts
  13. 1
      src/pages/list/card-list/_mock.ts
  14. 1
      src/pages/list/search/applications/_mock.ts
  15. 1
      src/pages/list/search/articles/_mock.ts
  16. 1398
      src/pages/user/login/__snapshots__/login.test.tsx.snap
  17. 4
      src/pages/user/login/index.tsx
  18. 1
      src/pages/user/register/_mock.ts

2
.github/workflows/ci.yml

@ -19,7 +19,7 @@ jobs:
with: with:
node-version: ${{ matrix.node_version }} node-version: ${{ matrix.node_version }}
- run: echo ${{github.ref}} - run: echo ${{github.ref}}
- run: npm install - run: npm install --legacy-peer-deps
- run: yarn run lint - run: yarn run lint
- run: yarn run tsc - run: yarn run tsc
- run: yarn run build - run: yarn run build

1
jest.config.ts

@ -7,7 +7,6 @@ export default async () => {
}), }),
}); });
console.log();
return { return {
...config, ...config,
testEnvironmentOptions: { testEnvironmentOptions: {

2
package.json

@ -12,6 +12,7 @@
"i18n-remove": "pro i18n-remove --locale=zh-CN --write", "i18n-remove": "pro i18n-remove --locale=zh-CN --write",
"postinstall": "max setup", "postinstall": "max setup",
"jest": "jest", "jest": "jest",
"lint": "npm run lint:js && npm run lint:prettier",
"lint:fix": "eslint --fix --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src ", "lint:fix": "eslint --fix --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src ",
"lint:js": "eslint --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src", "lint:js": "eslint --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src",
"lint:prettier": "prettier -c --write \"**/**.{js,jsx,tsx,ts,less,md,json}\" --end-of-line auto", "lint:prettier": "prettier -c --write \"**/**.{js,jsx,tsx,ts,less,md,json}\" --end-of-line auto",
@ -84,6 +85,7 @@
"@umijs/fabric": "^2.14.1", "@umijs/fabric": "^2.14.1",
"@umijs/lint": "^4.0.78", "@umijs/lint": "^4.0.78",
"@umijs/max": "^4.0.78", "@umijs/max": "^4.0.78",
"canvas": "^2.11.2",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"eslint": "^8.48.0", "eslint": "^8.48.0",
"express": "^4.18.2", "express": "^4.18.2",

11432
pnpm-lock.yaml

File diff suppressed because it is too large

2
src/global.style.ts

@ -1,6 +1,6 @@
import { createStyles } from 'antd-style'; import { createStyles } from 'antd-style';
const useStyles = createStyles(({ token }) => { const useStyles = createStyles(({}) => {
return { return {
colorWeak: { colorWeak: {
filter: 'invert(80%)', filter: 'invert(80%)',

1
src/pages/account/center/_mock.ts

@ -1,4 +1,3 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import type { Request, Response } from 'express'; import type { Request, Response } from 'express';
import type { ListItemDataType } from './data.d'; import type { ListItemDataType } from './data.d';

1
src/pages/account/settings/_mock.ts

@ -1,4 +1,3 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import type { Request, Response } from 'express'; import type { Request, Response } from 'express';
const city = require('./geographic/city.json'); const city = require('./geographic/city.json');

1
src/pages/dashboard/analysis/components/Charts/ChartCard/index.tsx

@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
import { Card } from 'antd'; import { Card } from 'antd';
import type { CardProps } from 'antd/es/card'; import type { CardProps } from 'antd/es/card';
import classNames from 'classnames'; import classNames from 'classnames';

1
src/pages/form/advanced-form/_mock.ts

@ -1,4 +1,3 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import type { Request, Response } from 'express'; import type { Request, Response } from 'express';
export default { export default {

1
src/pages/form/basic-form/_mock.ts

@ -1,4 +1,3 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import type { Request, Response } from 'express'; import type { Request, Response } from 'express';
export default { export default {

1
src/pages/form/step-form/_mock.ts

@ -1,4 +1,3 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import type { Request, Response } from 'express'; import type { Request, Response } from 'express';
export default { export default {

1
src/pages/list/basic-list/_mock.ts

@ -1,4 +1,3 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import type { Request, Response } from 'express'; import type { Request, Response } from 'express';
import type { BasicListItemDataType } from './data.d'; import type { BasicListItemDataType } from './data.d';

1
src/pages/list/card-list/_mock.ts

@ -1,4 +1,3 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import type { Request, Response } from 'express'; import type { Request, Response } from 'express';
import type { CardListItemDataType } from './data.d'; import type { CardListItemDataType } from './data.d';

1
src/pages/list/search/applications/_mock.ts

@ -1,4 +1,3 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import type { Request, Response } from 'express'; import type { Request, Response } from 'express';
import type { ListItemDataType } from './data.d'; import type { ListItemDataType } from './data.d';

1
src/pages/list/search/articles/_mock.ts

@ -1,4 +1,3 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import type { Request, Response } from 'express'; import type { Request, Response } from 'express';
import type { ListItemDataType } from './data.d'; import type { ListItemDataType } from './data.d';

1398
src/pages/user/login/__snapshots__/login.test.tsx.snap

File diff suppressed because it is too large

4
src/pages/user/login/index.tsx

@ -16,7 +16,7 @@ import {
ProFormText, ProFormText,
} from '@ant-design/pro-components'; } from '@ant-design/pro-components';
import { useEmotionCss } from '@ant-design/use-emotion-css'; import { useEmotionCss } from '@ant-design/use-emotion-css';
import { FormattedMessage, Helmet, history, SelectLang, useIntl, useModel } from '@umijs/max'; import { FormattedMessage, Helmet, SelectLang, useIntl, useModel } from '@umijs/max';
import { Alert, message, Tabs } from 'antd'; import { Alert, message, Tabs } from 'antd';
import React, { useState } from 'react'; import React, { useState } from 'react';
import { flushSync } from 'react-dom'; import { flushSync } from 'react-dom';
@ -126,7 +126,7 @@ const Login: React.FC = () => {
message.success(defaultLoginSuccessMessage); message.success(defaultLoginSuccessMessage);
await fetchUserInfo(); await fetchUserInfo();
const urlParams = new URL(window.location.href).searchParams; const urlParams = new URL(window.location.href).searchParams;
history.push(urlParams.get('redirect') || '/'); window.location.href = urlParams.get('redirect') || '/';
return; return;
} }
console.log(msg); console.log(msg);

1
src/pages/user/register/_mock.ts

@ -1,4 +1,3 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import type { Request, Response } from 'express'; import type { Request, Response } from 'express';
export default { export default {

Loading…
Cancel
Save