mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-18 14:13:37 +08:00
test(Anchor): optimize dataNowMockFn, avoid being consumed in advance (#18663)
* 优化 dataNowMockFn, 避免被提前消费 * test circleci/node:latest * change .circleci circleci/node:latest -> circleci/node:lts * add step command [node -v] check current node version * retry ci test * rebase master * retry CI test
This commit is contained in:
parent
bf374da148
commit
d9bfc689a4
@ -3,7 +3,7 @@ version: 2
|
||||
references:
|
||||
container_config: &container_config
|
||||
docker:
|
||||
- image: circleci/node:8
|
||||
- image: circleci/node:lts
|
||||
working_directory: ~/ant-design
|
||||
|
||||
attach_workspace: &attach_workspace
|
||||
|
@ -279,10 +279,13 @@ describe('Anchor Render', () => {
|
||||
let dateNowMock;
|
||||
|
||||
function dataNowMockFn() {
|
||||
return jest
|
||||
.spyOn(Date, 'now')
|
||||
.mockImplementationOnce(() => 0)
|
||||
.mockImplementationOnce(() => 1000);
|
||||
let start = 0;
|
||||
|
||||
const handler = () => {
|
||||
return (start += 1000);
|
||||
};
|
||||
|
||||
return jest.spyOn(Date, 'now').mockImplementation(handler);
|
||||
}
|
||||
|
||||
dateNowMock = dataNowMockFn();
|
||||
|
Loading…
Reference in New Issue
Block a user