[improvement] optimize jest fn called judgement (#3029)

This commit is contained in:
neverland
2019-03-21 18:57:44 +08:00
committed by GitHub
parent 7c4908a2e3
commit 8c051b8e1f
24 changed files with 63 additions and 64 deletions

View File

@@ -13,10 +13,9 @@ test('emit event', () => {
}
});
wrapper.trigger('click');
wrapper.trigger('click');
expect(input.mock.calls).toEqual([[true], [true]]);
expect(change.mock.calls).toEqual([[true], [true]]);
expect(input).toHaveBeenCalledWith(true);
expect(change).toHaveBeenCalledWith(true);
});
test('disabled', () => {
@@ -35,6 +34,6 @@ test('disabled', () => {
});
wrapper.trigger('click');
expect(input.mock.calls.length).toBeFalsy();
expect(change.mock.calls.length).toBeFalsy();
expect(input).toHaveBeenCalledTimes(0);
expect(change).toHaveBeenCalledTimes(0);
});