Match-id-e16de05a4950c19da839de4c26724b907bb5bfa4
This commit is contained in:
parent
8d516d8999
commit
9ca4b3851b
|
@ -127,10 +127,10 @@ module.exports = {
|
||||||
// runner: "jest-runner",
|
// runner: "jest-runner",
|
||||||
|
|
||||||
// The paths to modules that run some code to configure or set up the testing environment before each test
|
// The paths to modules that run some code to configure or set up the testing environment before each test
|
||||||
setupFilesAfterEnv: [require.resolve('./scripts/__tests__/jest/setupEnvironment.js')],
|
setupFiles: [require.resolve('./scripts/__tests__/jest/setupTests.js')],
|
||||||
|
|
||||||
// A list of paths to modules that run some code to configure or set up the testing framework before each test
|
// A list of paths to modules that run some code to configure or set up the testing framework before each test
|
||||||
setupFiles: [require.resolve('./scripts/__tests__/jest/setupTests.js')],
|
setupFilesAfterEnv: [require.resolve('./scripts/__tests__/jest/setupEnvironment.js')],
|
||||||
|
|
||||||
// A list of paths to snapshot serializer modules Jest should use for snapshot testing
|
// A list of paths to snapshot serializer modules Jest should use for snapshot testing
|
||||||
// snapshotSerializers: [],
|
// snapshotSerializers: [],
|
||||||
|
|
|
@ -4,7 +4,18 @@ import { act } from 'react-dom/test-utils';
|
||||||
|
|
||||||
|
|
||||||
describe('Hook Test', () => {
|
describe('Hook Test', () => {
|
||||||
const { useState, useReducer, useEffect, useLayoutEffect, useContext, useMemo, useCallback, useRef, useImperativeHandle, forwardRef } = React;
|
const {
|
||||||
|
useState,
|
||||||
|
useReducer,
|
||||||
|
useEffect,
|
||||||
|
useLayoutEffect,
|
||||||
|
useContext,
|
||||||
|
useMemo,
|
||||||
|
useCallback,
|
||||||
|
useRef,
|
||||||
|
useImperativeHandle,
|
||||||
|
forwardRef
|
||||||
|
} = React;
|
||||||
const { unmountComponentAtNode } = HorizonDOM;
|
const { unmountComponentAtNode } = HorizonDOM;
|
||||||
let container = null;
|
let container = null;
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
|
|
@ -88,14 +88,8 @@ describe('useState Hook Test', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('useState的惰性初始化', () => {
|
it('useState的惰性初始化', () => {
|
||||||
//let data = null;
|
|
||||||
const App = forwardRef((props, ref) => {
|
const App = forwardRef((props, ref) => {
|
||||||
const [num, setNum] = useState(() => {
|
const [num, setNum] = useState(() => {
|
||||||
// if (data === null) {
|
|
||||||
// data = ['initNum'];
|
|
||||||
// } else {
|
|
||||||
// data.push('initNum');
|
|
||||||
// }
|
|
||||||
Scheduler.unstable_yieldValue(props.initNum);
|
Scheduler.unstable_yieldValue(props.initNum);
|
||||||
return props.initNum
|
return props.initNum
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue