Browse Source

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
pull/18697/head
骗你是小猫咪 5 years ago
committed by 偏右
parent
commit
d9bfc689a4
  1. 2
      .circleci/config.yml
  2. 11
      components/anchor/__tests__/Anchor.test.js

2
.circleci/config.yml

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

11
components/anchor/__tests__/Anchor.test.js

@ -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…
Cancel
Save