diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-05 21:08:59 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-05 21:08:59 +0300 |
commit | 36d0a94b8533e140e5919367c4a1513c79af0cd4 (patch) | |
tree | 8fe6cf2c8b1f91d6dc0a62568196d40dbc2cd938 /spec/frontend/performance_bar | |
parent | 118f3e3bdbb8664ea79fd4ad9c6ad2316d0583b2 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/performance_bar')
3 files changed, 20 insertions, 3 deletions
diff --git a/spec/frontend/performance_bar/index_spec.js b/spec/frontend/performance_bar/index_spec.js index 6c1cbfa70a1..008961bf709 100644 --- a/spec/frontend/performance_bar/index_spec.js +++ b/spec/frontend/performance_bar/index_spec.js @@ -69,7 +69,7 @@ describe('performance bar wrapper', () => { it('adds the request immediately', () => { vm.addRequest('123', 'https://gitlab.com/'); - expect(vm.store.addRequest).toHaveBeenCalledWith('123', 'https://gitlab.com/'); + expect(vm.store.addRequest).toHaveBeenCalledWith('123', 'https://gitlab.com/', undefined); }); }); diff --git a/spec/frontend/performance_bar/services/performance_bar_service_spec.js b/spec/frontend/performance_bar/services/performance_bar_service_spec.js index 36bfd575c12..1bb70a43a1b 100644 --- a/spec/frontend/performance_bar/services/performance_bar_service_spec.js +++ b/spec/frontend/performance_bar/services/performance_bar_service_spec.js @@ -63,5 +63,17 @@ describe('PerformanceBarService', () => { ); }); }); + + describe('operationName', () => { + function requestUrl(response, peekUrl) { + return PerformanceBarService.callbackParams(response, peekUrl)[3]; + } + + it('gets the operation name from response.config', () => { + expect( + requestUrl({ headers: {}, config: { operationName: 'someOperation' } }, '/peek'), + ).toBe('someOperation'); + }); + }); }); }); diff --git a/spec/frontend/performance_bar/stores/performance_bar_store_spec.js b/spec/frontend/performance_bar/stores/performance_bar_store_spec.js index b7324ba2f6e..7d5c5031792 100644 --- a/spec/frontend/performance_bar/stores/performance_bar_store_spec.js +++ b/spec/frontend/performance_bar/stores/performance_bar_store_spec.js @@ -1,9 +1,9 @@ import PerformanceBarStore from '~/performance_bar/stores/performance_bar_store'; describe('PerformanceBarStore', () => { - describe('truncateUrl', () => { + describe('displayName', () => { let store; - const findUrl = (id) => store.findRequest(id).truncatedUrl; + const findUrl = (id) => store.findRequest(id).displayName; beforeEach(() => { store = new PerformanceBarStore(); @@ -41,6 +41,11 @@ describe('PerformanceBarStore', () => { store.addRequest('id', 'http://localhost:3001/h5bp/html5-boilerplate/#frag/ment'); expect(findUrl('id')).toEqual('html5-boilerplate'); }); + + it('appends the GraphQL operation name', () => { + store.addRequest('id', 'http://localhost:3001/api/graphql', 'someOperation'); + expect(findUrl('id')).toBe('graphql (someOperation)'); + }); }); describe('setRequestDetailsData', () => { |