diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-20 13:00:54 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-20 13:00:54 +0300 |
commit | 3cccd102ba543e02725d247893729e5c73b38295 (patch) | |
tree | f36a04ec38517f5deaaacb5acc7d949688d1e187 /spec/frontend/lib/utils/apollo_startup_js_link_spec.js | |
parent | 205943281328046ef7b4528031b90fbda70c75ac (diff) |
Add latest changes from gitlab-org/gitlab@14-10-stable-eev14.10.0-rc42
Diffstat (limited to 'spec/frontend/lib/utils/apollo_startup_js_link_spec.js')
-rw-r--r-- | spec/frontend/lib/utils/apollo_startup_js_link_spec.js | 51 |
1 files changed, 17 insertions, 34 deletions
diff --git a/spec/frontend/lib/utils/apollo_startup_js_link_spec.js b/spec/frontend/lib/utils/apollo_startup_js_link_spec.js index e58bc063004..06573f346e0 100644 --- a/spec/frontend/lib/utils/apollo_startup_js_link_spec.js +++ b/spec/frontend/lib/utils/apollo_startup_js_link_spec.js @@ -58,17 +58,16 @@ describe('StartupJSLink', () => { link = ApolloLink.from([startupLink, new ApolloLink(() => Observable.of(FORWARDED_RESPONSE))]); }; - it('forwards requests if no calls are set up', (done) => { + it('forwards requests if no calls are set up', () => { setupLink(); link.request(mockOperation()).subscribe((result) => { expect(result).toEqual(FORWARDED_RESPONSE); expect(startupLink.startupCalls).toBe(null); expect(startupLink.request).toEqual(StartupJSLink.noopRequest); - done(); }); }); - it('forwards requests if the operation is not pre-loaded', (done) => { + it('forwards requests if the operation is not pre-loaded', () => { window.gl = { startup_graphql_calls: [ { @@ -82,12 +81,11 @@ describe('StartupJSLink', () => { link.request(mockOperation({ operationName: 'notLoaded' })).subscribe((result) => { expect(result).toEqual(FORWARDED_RESPONSE); expect(startupLink.startupCalls.size).toBe(1); - done(); }); }); describe('variable match errors: ', () => { - it('forwards requests if the variables are not matching', (done) => { + it('forwards requests if the variables are not matching', () => { window.gl = { startup_graphql_calls: [ { @@ -101,11 +99,10 @@ describe('StartupJSLink', () => { link.request(mockOperation()).subscribe((result) => { expect(result).toEqual(FORWARDED_RESPONSE); expect(startupLink.startupCalls.size).toBe(0); - done(); }); }); - it('forwards requests if more variables are set in the operation', (done) => { + it('forwards requests if more variables are set in the operation', () => { window.gl = { startup_graphql_calls: [ { @@ -118,11 +115,10 @@ describe('StartupJSLink', () => { link.request(mockOperation()).subscribe((result) => { expect(result).toEqual(FORWARDED_RESPONSE); expect(startupLink.startupCalls.size).toBe(0); - done(); }); }); - it('forwards requests if less variables are set in the operation', (done) => { + it('forwards requests if less variables are set in the operation', () => { window.gl = { startup_graphql_calls: [ { @@ -136,11 +132,10 @@ describe('StartupJSLink', () => { link.request(mockOperation({ variables: { id: 3 } })).subscribe((result) => { expect(result).toEqual(FORWARDED_RESPONSE); expect(startupLink.startupCalls.size).toBe(0); - done(); }); }); - it('forwards requests if different variables are set', (done) => { + it('forwards requests if different variables are set', () => { window.gl = { startup_graphql_calls: [ { @@ -154,11 +149,10 @@ describe('StartupJSLink', () => { link.request(mockOperation({ variables: { id: 3 } })).subscribe((result) => { expect(result).toEqual(FORWARDED_RESPONSE); expect(startupLink.startupCalls.size).toBe(0); - done(); }); }); - it('forwards requests if array variables have a different order', (done) => { + it('forwards requests if array variables have a different order', () => { window.gl = { startup_graphql_calls: [ { @@ -172,13 +166,12 @@ describe('StartupJSLink', () => { link.request(mockOperation({ variables: { id: [4, 3] } })).subscribe((result) => { expect(result).toEqual(FORWARDED_RESPONSE); expect(startupLink.startupCalls.size).toBe(0); - done(); }); }); }); describe('error handling', () => { - it('forwards the call if the fetchCall is failing with a HTTP Error', (done) => { + it('forwards the call if the fetchCall is failing with a HTTP Error', () => { window.gl = { startup_graphql_calls: [ { @@ -192,11 +185,10 @@ describe('StartupJSLink', () => { link.request(mockOperation()).subscribe((result) => { expect(result).toEqual(FORWARDED_RESPONSE); expect(startupLink.startupCalls.size).toBe(0); - done(); }); }); - it('forwards the call if it errors (e.g. failing JSON)', (done) => { + it('forwards the call if it errors (e.g. failing JSON)', () => { window.gl = { startup_graphql_calls: [ { @@ -210,11 +202,10 @@ describe('StartupJSLink', () => { link.request(mockOperation()).subscribe((result) => { expect(result).toEqual(FORWARDED_RESPONSE); expect(startupLink.startupCalls.size).toBe(0); - done(); }); }); - it('forwards the call if the response contains an error', (done) => { + it('forwards the call if the response contains an error', () => { window.gl = { startup_graphql_calls: [ { @@ -228,11 +219,10 @@ describe('StartupJSLink', () => { link.request(mockOperation()).subscribe((result) => { expect(result).toEqual(FORWARDED_RESPONSE); expect(startupLink.startupCalls.size).toBe(0); - done(); }); }); - it("forwards the call if the response doesn't contain a data object", (done) => { + it("forwards the call if the response doesn't contain a data object", () => { window.gl = { startup_graphql_calls: [ { @@ -246,12 +236,11 @@ describe('StartupJSLink', () => { link.request(mockOperation()).subscribe((result) => { expect(result).toEqual(FORWARDED_RESPONSE); expect(startupLink.startupCalls.size).toBe(0); - done(); }); }); }); - it('resolves the request if the operation is matching', (done) => { + it('resolves the request if the operation is matching', () => { window.gl = { startup_graphql_calls: [ { @@ -265,11 +254,10 @@ describe('StartupJSLink', () => { link.request(mockOperation()).subscribe((result) => { expect(result).toEqual(STARTUP_JS_RESPONSE); expect(startupLink.startupCalls.size).toBe(0); - done(); }); }); - it('resolves the request exactly once', (done) => { + it('resolves the request exactly once', () => { window.gl = { startup_graphql_calls: [ { @@ -285,12 +273,11 @@ describe('StartupJSLink', () => { expect(startupLink.startupCalls.size).toBe(0); link.request(mockOperation()).subscribe((result2) => { expect(result2).toEqual(FORWARDED_RESPONSE); - done(); }); }); }); - it('resolves the request if the variables have a different order', (done) => { + it('resolves the request if the variables have a different order', () => { window.gl = { startup_graphql_calls: [ { @@ -304,11 +291,10 @@ describe('StartupJSLink', () => { link.request(mockOperation({ variables: { name: 'foo', id: 3 } })).subscribe((result) => { expect(result).toEqual(STARTUP_JS_RESPONSE); expect(startupLink.startupCalls.size).toBe(0); - done(); }); }); - it('resolves the request if the variables have undefined values', (done) => { + it('resolves the request if the variables have undefined values', () => { window.gl = { startup_graphql_calls: [ { @@ -324,11 +310,10 @@ describe('StartupJSLink', () => { .subscribe((result) => { expect(result).toEqual(STARTUP_JS_RESPONSE); expect(startupLink.startupCalls.size).toBe(0); - done(); }); }); - it('resolves the request if the variables are of an array format', (done) => { + it('resolves the request if the variables are of an array format', () => { window.gl = { startup_graphql_calls: [ { @@ -342,11 +327,10 @@ describe('StartupJSLink', () => { link.request(mockOperation({ variables: { id: [3, 4] } })).subscribe((result) => { expect(result).toEqual(STARTUP_JS_RESPONSE); expect(startupLink.startupCalls.size).toBe(0); - done(); }); }); - it('resolves multiple requests correctly', (done) => { + it('resolves multiple requests correctly', () => { window.gl = { startup_graphql_calls: [ { @@ -368,7 +352,6 @@ describe('StartupJSLink', () => { link.request(mockOperation({ operationName: OPERATION_NAME })).subscribe((result2) => { expect(result2).toEqual(STARTUP_JS_RESPONSE); expect(startupLink.startupCalls.size).toBe(0); - done(); }); }); }); |