diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-17 12:07:48 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-17 12:07:48 +0300 |
commit | 5bd24a54ef4ce3a38a860eb53b66d062c2382971 (patch) | |
tree | 5f5e65571dfcb2c62c27600ee7655dec4b44c923 /spec/frontend/jest_self_check | |
parent | 74673d04d25ffed35cbcf17cd42969bed0a4e705 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/jest_self_check')
-rw-r--r-- | spec/frontend/jest_self_check/mocks_spec.js | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/spec/frontend/jest_self_check/mocks_spec.js b/spec/frontend/jest_self_check/mocks_spec.js new file mode 100644 index 00000000000..f1e9e12e633 --- /dev/null +++ b/spec/frontend/jest_self_check/mocks_spec.js @@ -0,0 +1,43 @@ +import * as textUtils from '~/lib/utils/text_utility'; + +jest.mock('~/lib/utils/text_utility'); + +describe('does restore mocks config work?', () => { + describe('shared spy', () => { + const spy = jest.fn(); + + beforeEach(() => { + spy(); + }); + + it('is only called once', () => { + expect(spy).toHaveBeenCalledTimes(1); + }); + + it('is only called once B', () => { + expect(spy).toHaveBeenCalledTimes(1); + }); + + it('is only called once C', () => { + expect(spy).toHaveBeenCalledTimes(1); + }); + }); + + describe('module mock', () => { + beforeEach(() => { + textUtils.humanize(''); + }); + + it('is only called once', () => { + expect(textUtils.humanize).toHaveBeenCalledTimes(1); + }); + + it('is only called once B', () => { + expect(textUtils.humanize).toHaveBeenCalledTimes(1); + }); + + it('is only called once C', () => { + expect(textUtils.humanize).toHaveBeenCalledTimes(1); + }); + }); +}); |