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:
骗你是小猫咪 2019-09-05 11:33:11 +08:00 committed by 偏右
parent bf374da148
commit d9bfc689a4
2 changed files with 8 additions and 5 deletions

View File

@ -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

View File

@ -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();