diff --git a/HISTORY.md b/HISTORY.md index 1a855dd..53eec9d 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,3 +1,8 @@ +1.0.0 / 2016-10-27 +================== + * When no callback is provided, all API functions now return a native JS `Promise` + * Removed the non get/set method calls like `database.release(...)` deprecated in release `0.8.0` + 0.9.1 / 2016-10-24 ================== * Upgraded OAuth library to `oauth-1.0a` v2.0.0 diff --git a/README.md b/README.md index c6ae82e..59cb5da 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,8 @@ * Covers all API endpoints * Supports [pagination](http://www.discogs.com/developers/#page:home,header:home-pagination), [rate limiting](http://www.discogs.com/developers/#page:home,header:home-rate-limiting), etc. - * All database, marketplace and user functions implement a standard `function(err, data, rateLimit)` format for the callback + * All database, marketplace and user functions implement a standard `function(err, data, rateLimit)` format for the callback or return a + native JS [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) when no callback is provided * Easy access to protected endpoints with `Discogs Auth` * Includes OAuth 1.0a tools. Just plug in your consumer key and secret and do the OAuth dance * API functions grouped in their own namespace for easy access and isolation @@ -67,6 +68,20 @@ col.getReleases('USER_NAME', 0, {page: 2, per_page: 75}, function(err, data){ }); ``` +### Promises +When no callback is provided, the API functions return a native JS [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) for easy chaining. + +```javascript +var db = new Discogs().database(); +db.getRelease(1) + .then(function(release){ + return db.getArtist(release.artists[0].id); + }) + .then(function(artist){ + console.log(artist.name); + }); +``` + ### Output format User, artist and label profiles can be formatted in different ways: `plaintext`, `html` and `discogs`. `disconnect` defaults to `discogs`, but the output format can be set for each client instance. ```javascript @@ -111,6 +126,7 @@ app.get('/authorize', function(req, res){ ); }); ``` + #### 2. Authorize After redirection to the Discogs authorize URL in step 1, authorize the application. diff --git a/lib/client.js b/lib/client.js index c093734..1082724 100644 --- a/lib/client.js +++ b/lib/client.js @@ -5,8 +5,7 @@ var https = require('https'), url = require('url'), pkg = require('../package.json'), error = require('./error.js'), - util = require('./util.js'), - deprecate = require('depd')('disconnect'); + util = require('./util.js'); module.exports = DiscogsClient; @@ -38,7 +37,7 @@ var queue = require('./queue.js')({ * Object constructor * @param {string} [userAgent] - The name of the user agent to use to make API calls * @param {object} [auth] - Optional authorization data object - * @returns {DiscogsClient} + * @return {DiscogsClient} */ function DiscogsClient(userAgent, auth){ @@ -73,7 +72,7 @@ function DiscogsClient(userAgent, auth){ /** * Override the default configuration * @param {object} customConfig - Custom configuration object for Browserify/CORS/Proxy use cases - * @returns {DiscogsClient} + * @return {DiscogsClient} */ DiscogsClient.prototype.setConfig = function(customConfig){ util.merge(this.config, customConfig); @@ -87,7 +86,7 @@ DiscogsClient.prototype.setConfig = function(customConfig){ /** * Return whether the client is authenticated for the optionally given access level * @param {number} [level] - Optional authentication level - * @returns {boolean} + * @return {boolean} */ DiscogsClient.prototype.authenticated = function(level){ @@ -98,33 +97,35 @@ DiscogsClient.prototype.authenticated = function(level){ /** * Test authentication by getting the identity resource for the authenticated user * @param {function} callback - Callback function receiving the data + * @return {DiscogsClient|Promise} */ DiscogsClient.prototype.getIdentity = function(callback){ - this.get({url: '/oauth/identity', authLevel: 2}, callback); + return this.get({url: '/oauth/identity', authLevel: 2}, callback); }; -DiscogsClient.prototype.identity = deprecate.function(DiscogsClient.prototype.getIdentity, - 'client.identity: Use client.getIdentity instead'); - /** * Get info about the Discogs API and this client * @param {function} callback - Callback function receiving the data */ DiscogsClient.prototype.about = function(callback){ - var self = this; - this.get('', function(err, data){ - if(data){ - data.disconnect = { - version: pkg.version, - userAgent: self.config.userAgent, - authMethod: (self.auth ? self.auth.method : 'none'), - authLevel: (self.auth ? self.auth.level : 0) - }; - } - callback(err, data); - }); + var clientInfo = { + version: pkg.version, + userAgent: this.config.userAgent, + authMethod: (this.auth ? this.auth.method : 'none'), + authLevel: (this.auth ? this.auth.level : 0) + }; + if(typeof callback === 'function'){ + return this.get('', function(err, data){ + data && (data.disconnect = clientInfo); + callback(err, data); + }); + } + return this.get('').then(function(data){ + data && (data.disconnect = clientInfo); + return data; + }); }; /** @@ -135,8 +136,8 @@ DiscogsClient.prototype.about = function(callback){ * method: '', // Defaults to GET * data: {} // POST/PUT data as an object * } - * @param {function} [callback] - Callback function receiving the data - * @returns {DiscogsClient} + * @param {function} callback - Callback function receiving the data + * @return {DiscogsClient} */ DiscogsClient.prototype._rawRequest = function(options, callback){ @@ -180,7 +181,7 @@ DiscogsClient.prototype._rawRequest = function(options, callback){ } // Set the HTTPS request options - var options = { + var requestOptions = { host: urlParts.host||this.config.host, port: urlParts.port||this.config.port, path: urlParts.path, @@ -189,19 +190,17 @@ DiscogsClient.prototype._rawRequest = function(options, callback){ }; // Build the HTTPS request - var req = https.request(options, function(res){ + var req = https.request(requestOptions, function(res){ var data = '', rateLimit = null, add = function(chunk){ data += chunk.toString(); }; // Pass the data to the callback and pass an error on unsuccessful HTTP status var passData = function(){ - if(typeof callback === 'function'){ - var err = null, status = parseInt(res.statusCode, 10); - if(status > 399){ // Unsuccessful HTTP status? Then pass an error to the callback - var match = data.match(/^\{"message": "(.+)"\}/i); - err = new error.DiscogsError(status, ((match&&match[1]) ? match[1] : null)); - } - callback(err, data, rateLimit); + var err = null, status = parseInt(res.statusCode, 10); + if(status > 399){ // Unsuccessful HTTP status? Then pass an error to the callback + var match = data.match(/^\{"message": "(.+)"\}/i); + err = new error.DiscogsError(status, ((match&&match[1]) ? match[1] : null)); } + callback(err, data, rateLimit); }; // Find and add rate limiting when present @@ -230,7 +229,7 @@ DiscogsClient.prototype._rawRequest = function(options, callback){ res.on('data', add).on('end', passData); } }).on('error', function(err){ - if(typeof callback === 'function'){ callback(err); } + callback(err); }); // When present, write the data to the request @@ -249,19 +248,38 @@ DiscogsClient.prototype._rawRequest = function(options, callback){ * data: {} // POST/PUT data as an object * } * @param {function} [callback] - Callback function receiving the data - * @returns {DiscogsClient} + * @return {DiscogsClient|Promise} */ DiscogsClient.prototype._request = function(options, callback){ - var self = this, hasCb = (typeof callback === 'function'), + var client = this, doRequest = function(){ - self._rawRequest(options, function(err, data, rateLimit){ + client._rawRequest(options, function(err, data, rateLimit){ if(data && options.json && (data.indexOf(' 5) ? 5 : rating)}, callback); + return client.put({url: url, authLevel: 2}, {rating: ((rating > 5) ? 5 : rating)}, callback); } }; @@ -90,20 +86,19 @@ module.exports = function(client){ * Get master release data * @param {(number|string)} master - The Discogs master release ID * @param {function} [callback] - Callback function + * @return {DiscogsClient|Promise} */ database.getMaster = function(master, callback){ - client.get('/masters/'+master, callback); + return client.get('/masters/'+master, callback); }; - database.master = deprecate.function(database.getMaster, - 'database.master: Use database.getMaster instead'); - /** * Get the release versions contained in the given master release * @param {(number|string)} master - The Discogs master release ID * @param {object} [params] - optional pagination params * @param {function} [callback] - Callback function + * @return {DiscogsClient|Promise} */ database.getMasterVersions = function(master, params, callback){ @@ -113,30 +108,26 @@ module.exports = function(client){ }else{ path = util.addParams(path, params); } - client.get(path, callback); + return client.get(path, callback); }; - - database.masterVersions = deprecate.function(database.getMasterVersions, - 'database.masterVersions: Use database.getMasterVersions instead'); /** * Get label data * @param {(number|string)} label - The Discogs label ID * @param {function} [callback] - Callback function + * @return {DiscogsClient|Promise} */ database.getLabel = function(label, callback){ - client.get('/labels/'+label, callback); + return client.get('/labels/'+label, callback); }; - - database.label = deprecate.function(database.getLabel, - 'database.label: Use database.getLabel instead'); /** * Get label release data * @param {(number|string)} label - The Discogs label ID * @param {object} [params] - Optional pagination params * @param {function} [callback] - Callback function + * @return {DiscogsClient|Promise} */ database.getLabelReleases = function(label, params, callback){ @@ -146,30 +137,26 @@ module.exports = function(client){ }else{ path = util.addParams(path, params); } - client.get(path, callback); + return client.get(path, callback); }; - database.labelReleases = deprecate.function(database.getLabelReleases, - 'database.labelReleases: Use database.getLabelReleases instead'); - /** * Get an image * @param {string} url - The full image url * @param {function} [callback] - Callback function + * @return {DiscogsClient|Promise} */ database.getImage = function(url, callback){ - client.get({url: url, encoding: 'binary', queue: false, json: false}, callback); + return client.get({url: url, encoding: 'binary', queue: false, json: false}, callback); }; - - database.image = deprecate.function(database.getImage, - 'database.image: Use database.getImage instead'); /** * Search the database * @param {string} query - The search query * @param {object} [params] - Search parameters as defined on http://www.discogs.com/developers/#page:database,header:database-search * @param {function} [callback] - Callback function + * @return {DiscogsClient|Promise} */ database.search = function(query, params, callback){ @@ -180,7 +167,7 @@ module.exports = function(client){ obj = params; } if(query){ obj.q = query; } - client.get({url: util.addParams('/database/search', obj), authLevel: 1}, callback); + return client.get({url: util.addParams('/database/search', obj), authLevel: 1}, callback); }; return database; diff --git a/lib/list.js b/lib/list.js index e4836a3..fd78dae 100644 --- a/lib/list.js +++ b/lib/list.js @@ -10,6 +10,7 @@ module.exports = function(client){ * @param {(number|string)} list - The list ID * @param {object} [params] - Optional pagination params * @param {function} [callback] - The callback + * @return {DiscogsClient|Promise} */ list.getItems = function(list, params, callback){ @@ -19,7 +20,7 @@ module.exports = function(client){ }else{ path = util.addParams(path, params); } - client.get(path, callback); + return client.get(path, callback); }; return list; diff --git a/lib/marketplace.js b/lib/marketplace.js index 4144d00..dc69966 100644 --- a/lib/marketplace.js +++ b/lib/marketplace.js @@ -1,7 +1,6 @@ 'use strict'; -var util = require('./util.js'), - deprecate = require('depd')('disconnect'); +var util = require('./util.js'); module.exports = function(client){ var marketplace = {}; @@ -12,30 +11,26 @@ module.exports = function(client){ marketplace.getInventory = require('./user.js')(client).getInventory; - marketplace.inventory = deprecate.function(marketplace.getInventory, - 'marketplace.inventory: Use marketplace.getInventory instead'); - /** * Get a marketplace listing * @param {(number|string)} listing - The listing ID * @param {function} [callback] - The callback + * @return {DiscogsClient|Promise} */ marketplace.getListing = function(listing, callback){ - client.get('/marketplace/listings/'+listing, callback); + return client.get('/marketplace/listings/'+listing, callback); }; - marketplace.listing = deprecate.function(marketplace.getListing, - 'marketplace.listing: Use marketplace.getListing instead'); - /** * Create a marketplace listing * @param {object} data - The data for the listing * @param {function} [callback] - The callback + * @return {DiscogsClient|Promise} */ marketplace.addListing = function(data, callback){ - client.post({url: '/marketplace/listings', authLevel: 2}, data, callback); + return client.post({url: '/marketplace/listings', authLevel: 2}, data, callback); }; /** @@ -43,47 +38,29 @@ module.exports = function(client){ * @param {(number|string)} listing - The listing ID * @param {object} data - The data for the listing * @param {function} [callback] - The callback + * @return {DiscogsClient|Promise} */ marketplace.editListing = function(listing, data, callback){ - client.post({url: '/marketplace/listings/'+listing, authLevel: 2}, data, callback); + return client.post({url: '/marketplace/listings/'+listing, authLevel: 2}, data, callback); }; /** * Delete a marketplace listing * @param {(number|string)} [listing] - The listing ID * @param {function} [callback] - The callback + * @return {DiscogsClient|Promise} */ marketplace.deleteListing = function(listing, callback){ - client.delete({url: '/marketplace/listings/'+listing, authLevel: 2}, callback); - }; - - /** - * List your orders or get the details of one order - * @param {(object|string)} [params] - The optional sorting and pagination params or the order ID - * @param {function} [callback] - The callback - */ - - marketplace.orders = function(params, callback){ - if((arguments.length === 1) && (typeof params === 'function')){ - deprecate('marketplace.orders: Use marketplace.getOrders instead'); - marketplace.getOrders(params); - }else if(params){ - if(typeof params === 'object'){ - deprecate('marketplace.orders: Use marketplace.getOrders instead'); - marketplace.getOrders(params, callback); - }else{ // Params is the order ID - deprecate('marketplace.orders: Use marketplace.getOrder instead'); - marketplace.getOrder(params); - } - } + return client.delete({url: '/marketplace/listings/'+listing, authLevel: 2}, callback); }; /** * Get a list of the authenticated user's orders * @param {object} [params] - Optional sorting and pagination params * @param {function} [callback] - The callback + * @return {DiscogsClient|Promise} */ marketplace.getOrders = function(params, callback){ @@ -93,17 +70,18 @@ module.exports = function(client){ }else if(typeof params === 'object'){ path = util.addParams(path, params); } - client.get({url: path, authLevel: 2}, callback); + return client.get({url: path, authLevel: 2}, callback); }; /** * Get details of a marketplace order * @param {string} order - The order ID * @param {function} [callback] - The callback + * @return {DiscogsClient|Promise} */ marketplace.getOrder = function(order, callback){ - client.get({url: '/marketplace/orders/'+order, authLevel: 2}, callback); + return client.get({url: '/marketplace/orders/'+order, authLevel: 2}, callback); }; /** @@ -111,10 +89,11 @@ module.exports = function(client){ * @param {string} order - The order ID * @param {object} data - The data for the order * @param {function} [callback] - The callback + * @return {DiscogsClient|Promise} */ marketplace.editOrder = function(order, data, callback){ - client.post({url: '/marketplace/orders/'+order, authLevel: 2}, data, callback); + return client.post({url: '/marketplace/orders/'+order, authLevel: 2}, data, callback); }; /** @@ -122,6 +101,7 @@ module.exports = function(client){ * @param {string} order - The order ID * @param {object} [params] - Optional pagination parameters * @param {function} [callback] - The callback + * @return {DiscogsClient|Promise} */ marketplace.getOrderMessages = function(order, params, callback){ @@ -131,31 +111,27 @@ module.exports = function(client){ }else{ path = util.addParams(path, params); } - client.get({url: path, authLevel: 2}, callback); + return client.get({url: path, authLevel: 2}, callback); }; - marketplace.orderMessages = deprecate.function(marketplace.getOrderMessages, - 'marketplace.orderMessages: Use marketplace.getOrderMessages instead'); - /** * Add a message to the given order ID * @param {string} order - The order ID * @param {object} data - The message data * @param {function} [callback] - The callback + * @return {DiscogsClient|Promise} */ marketplace.addOrderMessage = function(order, data, callback){ - client.post({url: '/marketplace/orders/'+order+'/messages', authLevel: 2}, data, callback); + return client.post({url: '/marketplace/orders/'+order+'/messages', authLevel: 2}, data, callback); }; - marketplace.orderAddMessage = deprecate.function(marketplace.addOrderMessage, - 'marketplace.orderAddMessage: Use marketplace.addOrderMessage instead'); - /** * Get the marketplace fee for a given price * @param {(number|string)} price - The price as a number or string * @param {string} [currency] - Optional currency as one of USD, GBP, EUR, CAD, AUD, or JPY. Defaults to USD. * @param {function} [callback] - The callback + * @return {DiscogsClient|Promise} */ marketplace.getFee = function(price, currency, callback){ @@ -165,24 +141,19 @@ module.exports = function(client){ }else if(currency){ // Get the fee in a given currency path += '/'+currency; } - client.get(path, callback); + return client.get(path, callback); }; - marketplace.fee = deprecate.function(marketplace.getFee, - 'marketplace.fee: Use marketplace.getFee instead'); - /** * Get price suggestions for a given release ID in the user's selling currency * @param {(number|string)} release - The release ID * @param {function} [callback] - The callback + * @return {DiscogsClient|Promise} */ marketplace.getPriceSuggestions = function(release, callback){ - client.get({url: '/marketplace/price_suggestions/'+release, authLevel: 2}, callback); + return client.get({url: '/marketplace/price_suggestions/'+release, authLevel: 2}, callback); }; - marketplace.suggestPrice = deprecate.function(marketplace.getPriceSuggestions, - 'marketplace.suggestPrice: Use marketplace.getPriceSuggestions instead'); - return marketplace; }; \ No newline at end of file diff --git a/lib/user.js b/lib/user.js index c7fa492..fa38e7c 100644 --- a/lib/user.js +++ b/lib/user.js @@ -1,7 +1,6 @@ 'use strict'; -var util = require('./util.js'), - deprecate = require('depd')('disconnect'); +var util = require('./util.js'); module.exports = function(client){ var user = {}; @@ -10,20 +9,19 @@ module.exports = function(client){ * Get the profile for the given user * @param {string} user - The user name * @param {function} [callback] - The callback + * @return {DiscogsClient|Promise} */ user.getProfile = function(user, callback){ - client.get('/users/'+util.escape(user), callback); + return client.get('/users/'+util.escape(user), callback); }; - user.profile = deprecate.function(user.getProfile, - 'user.profile: Use user.getProfile instead'); - /** * Get the inventory for the given user * @param {string} user - The user name * @param {object} [params] - Extra params like status, sort and sort_order, pagination * @param {function} [callback] - The callback + * @return {DiscogsClient|Promise} */ user.getInventory = function(user, params, callback){ @@ -33,21 +31,15 @@ module.exports = function(client){ }else{ // Add pagination params when present path = util.addParams(path, params); } - client.get(path, callback); + return client.get(path, callback); }; - user.inventory = deprecate.function(user.getInventory, - 'user.inventory: Use user.getInventory instead'); - /** * Copy the client getIdentity function to the user module */ user.getIdentity = client.getIdentity; - user.identity = deprecate.function(user.getIdentity, - 'user.identity: Use user.getIdentity instead'); - /** * Expose the collection functions and pass the client instance * @returns {object} @@ -80,6 +72,7 @@ module.exports = function(client){ * @param {string} user - The user name * @param {object} [params] - Optional pagination and sorting params * @param {function} [callback] - The callback + * @return {DiscogsClient|Promise} */ user.getContributions = function(user, params, callback){ @@ -89,17 +82,15 @@ module.exports = function(client){ }else{ // Add pagination params when present path = util.addParams(path, params); } - client.get(path, callback); + return client.get(path, callback); }; - user.contributions = deprecate.function(user.getContributions, - 'user.contributions: Use user.getContributions instead'); - /** * Get the submissions for the given user * @param {string} user - The user name * @param {object} [params] - Optional pagination params * @param {function} [callback] - The callback + * @return {DiscogsClient|Promise} */ user.getSubmissions = function(user, params, callback){ @@ -109,17 +100,15 @@ module.exports = function(client){ }else{ // Add pagination params when present path = util.addParams(path, params); } - client.get(path, callback); + return client.get(path, callback); }; - user.submissions = deprecate.function(user.getSubmissions, - 'user.submissions: Use user.getSubmissions instead'); - /** * Get the lists for the given user * @param {string} user - The user name * @param {object} [params] - Optional pagination params * @param {function} [callback] - The callback + * @return {DiscogsClient|Promise} */ user.getLists = function(user, params, callback){ @@ -129,8 +118,8 @@ module.exports = function(client){ }else{ // Add pagination params when present path = util.addParams(path, params); } - client.get(path, callback); - } + return client.get(path, callback); + }; return user; }; \ No newline at end of file diff --git a/lib/wantlist.js b/lib/wantlist.js index c84660c..eac3cb4 100644 --- a/lib/wantlist.js +++ b/lib/wantlist.js @@ -1,7 +1,6 @@ 'use strict'; -var util = require('./util.js'), - deprecate = require('depd')('disconnect'); +var util = require('./util.js'); module.exports = function(client){ var wantlist = {}; @@ -11,6 +10,7 @@ module.exports = function(client){ * @param {string} user - The user name * @param {object} [params] - Optional pagination params * @param {function} [callback] - The callback + * @return {DiscogsClient|Promise} */ wantlist.getReleases = function(user, params, callback){ @@ -20,18 +20,16 @@ module.exports = function(client){ }else{ path = util.addParams(path, params); } - client.get(path, callback); + return client.get(path, callback); }; - wantlist.releases = deprecate.function(wantlist.getReleases, - 'wantlist.releases: Use wantlist.getReleases instead'); - /** * Add a release to the user's wantlist * @param {string} user - The user name * @param {(number|string)} release - The release ID * @param {object} [data] - Optional notes and rating * @param {function} [callback] - The callback + * @return {DiscogsClient|Promise} */ wantlist.addRelease = function(user, release, data, callback){ @@ -40,7 +38,7 @@ module.exports = function(client){ callback = data; _data = null; } - client.put({url: '/users/'+util.escape(user)+'/wants/'+release, authLevel: 2}, _data, callback); + return client.put({url: '/users/'+util.escape(user)+'/wants/'+release, authLevel: 2}, _data, callback); }; /** @@ -49,10 +47,11 @@ module.exports = function(client){ * @param {(number|string)} release - The release ID * @param {object} data - The notes and rating {notes: 'Test', rating: 4} * @param {function} [callback] - The callback + * @return {DiscogsClient|Promise} */ wantlist.editNotes = function(user, release, data, callback){ - client.put({url: '/users/'+util.escape(user)+'/wants/'+release, authLevel: 2}, data, callback); + return client.put({url: '/users/'+util.escape(user)+'/wants/'+release, authLevel: 2}, data, callback); }; /** @@ -60,10 +59,11 @@ module.exports = function(client){ * @param {string} user - The user name * @param {(number|string)} release - The release ID * @param {function} [callback] - The callback + * @return {DiscogsClient|Promise} */ wantlist.removeRelease = function(user, release, callback){ - client.delete({url: '/users/'+util.escape(user)+'/wants/'+release, authLevel: 2}, callback); + return client.delete({url: '/users/'+util.escape(user)+'/wants/'+release, authLevel: 2}, callback); }; return wantlist; diff --git a/package.json b/package.json index 827f7ce..cb78cc0 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "disconnect", "description": "A full featured Discogs API v2.0 client library", - "version": "0.9.1", + "version": "1.0.0", "keywords": ["discogs", "api", "client", "oauth"], "homepage": "https://github.com/bartve/disconnect", "bugs": "https://github.com/bartve/disconnect/issues", @@ -19,14 +19,13 @@ "test": "node test/all.js" }, "dependencies": { - "oauth-1.0a": "2.x.x", - "depd": "1.x.x" + "oauth-1.0a": "2.x.x" }, "devDependencies": { "nock": "2.x.x", "wru": "0.x.x" }, "engines": { - "node": ">= 0.10.0" + "node": ">= 0.12.0" } } \ No newline at end of file diff --git a/test/client.js b/test/client.js index ed7269a..5a6bc2c 100644 --- a/test/client.js +++ b/test/client.js @@ -22,6 +22,19 @@ var tests = module.exports = [ wru.assert('Correct response data', (data && (data.id === 1))); })); } + },{ + name: 'DiscogsClient: Test Promise', + test: function(){ + var client = new DiscogsClient(); + var promise = client.about(); + var isPromise = (typeof promise.then === 'function'); + wru.assert('Returns Promise', isPromise); + if(isPromise){ + promise.then(wru.async(function(data){ + wru.assert('Promis resolved', (typeof data.disconnect !== 'undefined')); + })); + } + } },{ name: 'DiscogsClient: Test custom configuration', test: function(){