From 748159800a418829c6f52113d5f7862b754f17be Mon Sep 17 00:00:00 2001 From: Benjamin Coenen Date: Fri, 27 May 2016 16:37:00 +0200 Subject: [PATCH] fix(tests): delete arrow functions --- tests/02_REST_check.js | 64 +++++++++++++++++++++------- tests/03_REST_auth.js | 16 +++++-- tests/04_REST_me.js | 36 +++++++++++----- tests/05_REST_unicode.js | 4 +- tests/integration/01_REST_noAuth.js | 4 +- tests/integration/02_REST_domain.js | 8 +++- tests/integration/03_REST_unicode.js | 8 +++- 7 files changed, 104 insertions(+), 36 deletions(-) diff --git a/tests/02_REST_check.js b/tests/02_REST_check.js index 877eaed..3ea2642 100644 --- a/tests/02_REST_check.js +++ b/tests/02_REST_check.js @@ -100,8 +100,12 @@ exports.REST_check = { }); rest.requestPromised('GET', '/deprecated/my-service/route') - .then((resp) => assert.ok(!resp)) - .catch((err) => assert.ok(err)); + .then(function (resp) { + assert.ok(!resp); + }) + .catch(function (err) { + assert.ok(err); + }); }, 'Check call not found warning': function (done) { 'use strict'; @@ -150,8 +154,12 @@ exports.REST_check = { }); rest.requestPromised('GET', '/auth/not-found') - .then((resp) => assert.ok(!resp)) - .catch((err) => assert.ok(err)); + .then(function (resp) { + assert.ok(!resp); + }) + .catch(function (err) { + assert.ok(err); + }); }, 'Check api not found warning': function (done) { 'use strict'; @@ -206,8 +214,12 @@ exports.REST_check = { }); rest.requestPromised('GET', '/auth') - .then((resp) => assert.ok(!resp)) - .catch((err) => assert.ok(err)); + .then(function (resp) { + assert.ok(!resp); + }) + .catch(function (err) { + assert.ok(err); + }); }, 'Check HTTP method not found warning': function (done) { 'use strict'; @@ -260,8 +272,12 @@ exports.REST_check = { }); rest.requestPromised('OVH', '/me') - .then((resp) => assert.ok(!resp)) - .catch((err) => assert.ok(err)); + .then(function (resp) { + assert.ok(!resp); + }) + .catch(function (err) { + assert.ok(err); + }); }, 'Call method without CK': function (done) { 'use strict'; @@ -314,8 +330,12 @@ exports.REST_check = { }); rest.requestPromised('GET', '/me') - .then((resp) => assert.ok(!resp)) - .catch((err) => assert.ok(err)); + .then(function (resp) { + assert.ok(!resp); + }) + .catch(function (err) { + assert.ok(err); + }); }, 'Unable to load schema': function (done) { 'use strict'; @@ -357,8 +377,12 @@ exports.REST_check = { }); rest.requestPromised('GET', '/me') - .then((resp) => assert.ok(!resp)) - .catch((err) => assert.equal(err.error, '[OVH] Unable to load schema /1.0/meh.json, HTTP response code: 404')) + .then(function (resp) { + assert.ok(!resp); + }) + .catch(function (err) { + assert.equal(err.error, '[OVH] Unable to load schema /1.0/meh.json, HTTP response code: 404'); + }) .finally(done); }, 'Unable to parse schema': function (done) { @@ -401,8 +425,12 @@ exports.REST_check = { }); rest.requestPromised('GET', '/me') - .then((resp) => assert.ok(!resp)) - .catch((err) => assert.equal(err.error, '[OVH] Unable to parse the schema: /1.0/me.json')) + .then(function (resp) { + assert.ok(!resp); + }) + .catch(function (err) { + assert.equal(err.error, '[OVH] Unable to parse the schema: /1.0/me.json'); + }) .finally(done); }, 'Unable to fetch time': function (done) { @@ -439,8 +467,12 @@ exports.REST_check = { }); rest.requestPromised('GET', '/me') - .then((resp) => assert.ok(!resp)) - .catch((err) => assert.equal(err.error, '[OVH] Unable to fetch OVH API time')) + .then(function (resp) { + assert.ok(!resp); + }) + .catch(function (err) { + assert.equal(err.error, '[OVH] Unable to fetch OVH API time'); + }) .finally(done); } }; diff --git a/tests/03_REST_auth.js b/tests/03_REST_auth.js index 716fe31..ad89dee 100644 --- a/tests/03_REST_auth.js +++ b/tests/03_REST_auth.js @@ -65,8 +65,12 @@ exports.REST_call = { }); rest.requestPromised('GET', '/auth/time', {}) - .then((result) => assert.ok(typeof(result) === 'number')) - .catch((err) => assert.ok(!err)) + .then(function (result) { + assert.ok(typeof(result) === 'number'); + }) + .catch(function (err) { + assert.ok(!err); + }) .finally(done); }, 'GET /auth/credential - ovh.request()': function (done) { @@ -127,8 +131,12 @@ exports.REST_call = { ], 'redirection': 'https://npmjs.org/package/ovh' }) - .then((credential) => assert.ok(credential && credential.state === 'pendingValidation')) - .catch((err) => assert.ok(!err)) + .then(function (credential) { + assert.ok(credential && credential.state === 'pendingValidation'); + }) + .catch(function (err) { + assert.ok(!err); + }) .finally(done); } }; diff --git a/tests/04_REST_me.js b/tests/04_REST_me.js index 74153f1..0c0b304 100644 --- a/tests/04_REST_me.js +++ b/tests/04_REST_me.js @@ -81,7 +81,9 @@ exports.REST_me = { rest.requestPromised('PUT', '/me', { 'city': 'Roubaix Valley' }) - .catch((err) => assert.ok(!err)) + .catch(function (err) { + assert.ok(!err); + }) .finally(done); }, 'PUT /me - ovh.request() - 403 [promised]': function (done) { @@ -106,8 +108,10 @@ exports.REST_me = { rest.requestPromised('PUT', '/me', { 'city': 'Roubaix Valley' }) - .then((resp) => assert.ok(!resp)) - .catch((err) => { + .then(function (resp) { + assert.ok(!resp); + }) + .catch(function (err) { assert.equal(err.error, 403); assert.equal(err.message, 'This credential is not valid'); }) @@ -153,7 +157,9 @@ exports.REST_me = { rest.requestPromised('GET', '/me/agreements/{id}', { 'id': 42 }) - .catch((err) => assert.ok(!err)) + .catch(function (err) { + assert.ok(!err); + }) .finally(done); }, 'GET /me/agreements - Filtering': function (done) { @@ -207,8 +213,12 @@ exports.REST_me = { rest.requestPromised('GET', '/me/agreement', { 'agreed': 'ok' }) - .then((agreements) => assert.equal(agreements.length, 0)) - .catch((err) => assert.ok(!err)) + .then(function (agreements) { + assert.equal(agreements.length, 0); + }) + .catch(function (err) { + assert.ok(!err); + }) .finally(done); }, 'PUT /me - Remove undefined': function (done) { @@ -262,8 +272,10 @@ exports.REST_me = { 'city': 'Roubaix Valley', 'firstname': undefined }) - .then((resp) => assert.ok(!resp)) - .catch((err) => { + .then(function (resp) { + assert.ok(!resp); + }) + .catch(function (err) { assert.equal(err.error, 403); assert.equal(err.message, 'This credential is not valid'); }) @@ -306,8 +318,12 @@ exports.REST_me = { }); rest.requestPromised('DELETE', '/todelete') - .then((resp) => assert.equal(resp, null)) - .catch((err) => assert.ok(!err)) + .then(function (resp) { + assert.equal(resp, null); + }) + .catch(function (err) { + assert.ok(!err); + }) .finally(done); } }; diff --git a/tests/05_REST_unicode.js b/tests/05_REST_unicode.js index 2af05a2..661e764 100644 --- a/tests/05_REST_unicode.js +++ b/tests/05_REST_unicode.js @@ -70,7 +70,9 @@ exports.REST_sms = { var rest = ovh(apiKeys); rest.requestPromised('POST', '/sms/foo/jobs', {'message': 'tèsté'}) - .catch((err) => assert.ok(!err)) + .catch(function (err) { + assert.ok(!err); + }) .finally(done); } }; diff --git a/tests/integration/01_REST_noAuth.js b/tests/integration/01_REST_noAuth.js index d647ee6..3d7d365 100644 --- a/tests/integration/01_REST_noAuth.js +++ b/tests/integration/01_REST_noAuth.js @@ -61,7 +61,9 @@ exports.REST_call = { rest.requestPromised('POST', '/newAccount', { email: 'h@ovh.fr', }) - .then((result) => assert.ok(result.indexOf('Missing') > -1)) + .then(function (result) { + assert.ok(result.indexOf('Missing') > -1); + }) .finally(done); } }; diff --git a/tests/integration/02_REST_domain.js b/tests/integration/02_REST_domain.js index 84e3f82..c502901 100644 --- a/tests/integration/02_REST_domain.js +++ b/tests/integration/02_REST_domain.js @@ -59,8 +59,12 @@ exports.REST_domain = { var rest = ovh(apiKeys); rest.requestPromised('GET', '/domain/zone') - .then((zones) => assert.ok(zones.length >= 1)) - .catch((err) => assert.ok(!err)) + .then(function (zones) { + assert.ok(zones.length >= 1); + }) + .catch(function (err) { + assert.ok(!err); + }) .finally(done); } }; diff --git a/tests/integration/03_REST_unicode.js b/tests/integration/03_REST_unicode.js index daf9c9b..6725786 100644 --- a/tests/integration/03_REST_unicode.js +++ b/tests/integration/03_REST_unicode.js @@ -56,8 +56,12 @@ exports.REST_sms = { var rest = ovh(apiKeys); rest.request('POST', '/sms/foo/jobs', {'message': 'tèsté'}) - .then((msg) => assert.ok(!msg)) - .catch((err) => assert.equal(err.error, 401)) + .then(function (msg) { + assert.ok(!msg); + }) + .catch(function (err) { + assert.equal(err.error, 401); + }) .finally(done); } };