summaryrefslogtreecommitdiff
path: root/spec/frontend/lib/utils/apollo_startup_js_link_spec.js
diff options
context:
space:
mode:
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.js51
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();
});
});
});