diff options
author | Lee Tickett <lee@tickett.net> | 2019-09-04 06:45:28 +0300 |
---|---|---|
committer | Paul Slaughter <pslaughter@gitlab.com> | 2019-09-04 06:45:28 +0300 |
commit | e8c58d62fb8da5426eed545f4182b9e85ff326ff (patch) | |
tree | 669f8db6df10c7407b6be8b9c66158f3489add6d /spec/javascripts/groups | |
parent | df6f1dd93f0f427a2c66c07ea31bdb17a7efaca6 (diff) |
Remove vue resource from group service
Addresses https://gitlab.com/gitlab-org/gitlab-ce/issues/66750
Diffstat (limited to 'spec/javascripts/groups')
-rw-r--r-- | spec/javascripts/groups/components/app_spec.js | 3 | ||||
-rw-r--r-- | spec/javascripts/groups/service/groups_service_spec.js | 17 |
2 files changed, 9 insertions, 11 deletions
diff --git a/spec/javascripts/groups/components/app_spec.js b/spec/javascripts/groups/components/app_spec.js index 31873311e16..23b2564d3f9 100644 --- a/spec/javascripts/groups/components/app_spec.js +++ b/spec/javascripts/groups/components/app_spec.js @@ -1,3 +1,4 @@ +import '~/flash'; import $ from 'jquery'; import Vue from 'vue'; @@ -333,7 +334,7 @@ describe('AppComponent', () => { it('hides modal confirmation leave group and remove group item from tree', done => { const notice = `You left the "${childGroupItem.fullName}" group.`; - spyOn(vm.service, 'leaveGroup').and.returnValue(returnServicePromise({ notice })); + spyOn(vm.service, 'leaveGroup').and.returnValue(Promise.resolve({ data: { notice } })); spyOn(vm.store, 'removeGroup').and.callThrough(); spyOn(window, 'Flash'); spyOn($, 'scrollTo'); diff --git a/spec/javascripts/groups/service/groups_service_spec.js b/spec/javascripts/groups/service/groups_service_spec.js index 339e5131615..45db962a1ef 100644 --- a/spec/javascripts/groups/service/groups_service_spec.js +++ b/spec/javascripts/groups/service/groups_service_spec.js @@ -1,11 +1,8 @@ -import Vue from 'vue'; -import VueResource from 'vue-resource'; +import axios from '~/lib/utils/axios_utils'; import GroupsService from '~/groups/service/groups_service'; import { mockEndpoint, mockParentGroupItem } from '../mock_data'; -Vue.use(VueResource); - describe('GroupsService', () => { let service; @@ -15,8 +12,8 @@ describe('GroupsService', () => { describe('getGroups', () => { it('should return promise for `GET` request on provided endpoint', () => { - spyOn(service.groups, 'get').and.stub(); - const queryParams = { + spyOn(axios, 'get').and.stub(); + const params = { page: 2, filter: 'git', sort: 'created_asc', @@ -25,21 +22,21 @@ describe('GroupsService', () => { service.getGroups(55, 2, 'git', 'created_asc', true); - expect(service.groups.get).toHaveBeenCalledWith({ parent_id: 55 }); + expect(axios.get).toHaveBeenCalledWith(mockEndpoint, { params: { parent_id: 55 } }); service.getGroups(null, 2, 'git', 'created_asc', true); - expect(service.groups.get).toHaveBeenCalledWith(queryParams); + expect(axios.get).toHaveBeenCalledWith(mockEndpoint, { params }); }); }); describe('leaveGroup', () => { it('should return promise for `DELETE` request on provided endpoint', () => { - spyOn(Vue.http, 'delete').and.stub(); + spyOn(axios, 'delete').and.stub(); service.leaveGroup(mockParentGroupItem.leavePath); - expect(Vue.http.delete).toHaveBeenCalledWith(mockParentGroupItem.leavePath); + expect(axios.delete).toHaveBeenCalledWith(mockParentGroupItem.leavePath); }); }); }); |