diff options
author | Winnie Hellmann <winnie@gitlab.com> | 2018-04-25 00:35:32 +0300 |
---|---|---|
committer | Clement Ho <clemmakesapps@gmail.com> | 2018-04-25 00:35:32 +0300 |
commit | 92be3461d2bac8383e55b56fe6558a8732741ddc (patch) | |
tree | 67687489a499d906e95970a59c2f0eaff09609b9 /spec/javascripts/commits_spec.js | |
parent | 87cdd43b5dff255a8e1bccb23bcc90ddb9156f61 (diff) |
Mock Pager in Karma tests
Diffstat (limited to 'spec/javascripts/commits_spec.js')
-rw-r--r-- | spec/javascripts/commits_spec.js | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/spec/javascripts/commits_spec.js b/spec/javascripts/commits_spec.js index 977298b9221..60d100e8544 100644 --- a/spec/javascripts/commits_spec.js +++ b/spec/javascripts/commits_spec.js @@ -3,6 +3,7 @@ import 'vendor/jquery.endless-scroll'; import MockAdapter from 'axios-mock-adapter'; import axios from '~/lib/utils/axios_utils'; import CommitsList from '~/commits'; +import Pager from '~/pager'; describe('Commits List', () => { let commitsList; @@ -14,6 +15,7 @@ describe('Commits List', () => { </form> <ol id="commits-list"></ol> `); + spyOn(Pager, 'init').and.stub(); commitsList = new CommitsList(25); }); @@ -68,9 +70,10 @@ describe('Commits List', () => { mock.restore(); }); - it('should save the last search string', (done) => { + it('should save the last search string', done => { commitsList.searchField.val('GitLab'); - commitsList.filterResults() + commitsList + .filterResults() .then(() => { expect(ajaxSpy).toHaveBeenCalled(); expect(commitsList.lastSearch).toEqual('GitLab'); @@ -80,8 +83,9 @@ describe('Commits List', () => { .catch(done.fail); }); - it('should not make ajax call if the input does not change', (done) => { - commitsList.filterResults() + it('should not make ajax call if the input does not change', done => { + commitsList + .filterResults() .then(() => { expect(ajaxSpy).not.toHaveBeenCalled(); expect(commitsList.lastSearch).toEqual(''); |