Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bitly

Package Overview
Dependencies
Maintainers
1
Versions
124
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bitly - npm Package Compare versions

Comparing version 2.0.0 to 3.0.0

fixtures/generated/014376ba7c48a5b97356ad409fd8c977

71

index.js

@@ -11,3 +11,3 @@ /**

var url = require('url');
var http = require('http');
var https = require('https');

@@ -20,7 +20,7 @@ /**

*/
var Bitly = function(login, api_key, options) {
var Bitly = function(access_token, options) {
// Set default options
options = options || {
format: 'json',
api_url: 'api.bit.ly',
api_url: 'api-ssl.bitly.com',
api_version: 'v3',

@@ -32,4 +32,3 @@ domain: 'bit.ly'

this.config = {
login: login,
api_key: api_key,
access_token: access_token,
format: options.format,

@@ -52,4 +51,7 @@ api_url: options.api_url,

Bitly.prototype._generateNiceUrl = function(query, method) {
// Make sure the access_token gets sent with every query
query['access_token'] = this.config.access_token;
var result = url.parse(url.format({
protocol: 'http',
protocol: 'https',
hostname: this.config.api_url,

@@ -80,3 +82,3 @@ pathname: '/' + this.config.api_version + '/' + method,

// Pass the requested URL as an object to the get request
http.get(request_query, function(res) {
https.get(request_query, function(res) {
var data = [];

@@ -162,4 +164,2 @@

var query = {
login: this.config.login,
apiKey: this.config.api_key,
format: this.config.format,

@@ -185,4 +185,2 @@ longUrl: longUrl,

var query = {
login: this.config.login,
apiKey: this.config.api_key,
format: this.config.format,

@@ -210,4 +208,2 @@ domain: this.config.domain

var query = {
login: this.config.login,
apiKey: this.config.api_key,
format: this.config.format,

@@ -235,4 +231,2 @@ domain: this.config.domain

var query = {
login: this.config.login,
apiKey: this.config.api_key,
format: this.config.format,

@@ -261,4 +255,2 @@ domain: this.config.domain

var query = {
login: this.config.login,
apiKey: this.config.api_key,
format: this.config.format,

@@ -286,4 +278,2 @@ domain: this.config.domain

var query = {
login: this.config.login,
apiKey: this.config.api_key,
format: this.config.format,

@@ -306,4 +296,2 @@ url: links,

var query = {
login: this.config.login,
apiKey: this.config.api_key,
format: this.config.format,

@@ -334,4 +322,2 @@ domain: this.config.domain

var query = {
login: this.config.login,
apiKey: this.config.api_key,
format: this.config.format,

@@ -354,4 +340,2 @@ domain: this.config.domain

var query = {
login: this.config.login,
apiKey: this.config.api_key,
format: this.config.format,

@@ -374,4 +358,2 @@ domain: this.config.domain

var query = {
login: this.config.login,
apiKey: this.config.api_key,
format: this.config.format,

@@ -385,18 +367,31 @@ domain: domain

/**
* Request to validate that a login + API key are enabled with Bitly
* @param {String} x_login The login to be validated
* @param {String} x_apiKey The API key to be validated
* @param {Function=} cb The callback
* Edit an existing link's metadata
* @param {String|Array} metadata_field Metadata field to edit (title, note, private, user_ts or archived). To edit
* multiple fields, pass an array of field names as strings, e.g. ['title', 'note']
* @param {String} link The Bitlink to be edited (requires protocol, i.e "example.com" won't work but "http://example.com"
* will)
* @param {String|Array} new_value The new value for the edited metadata. If you pass an array to metadata_field, you
* have to pass an array to new_value. The index have to match those in metadata_field, e.g. metadata_field[0] will be
* changed to new_value[0] etc.
* @param {Function=} cb The callback
* @return {Promise|void}
*/
Bitly.prototype.validate = function(x_login, x_apiKey, cb) {
Bitly.prototype.linkEdit = function(metadata_field, link, new_value, cb) {
var query = {
login: this.config.login,
apiKey: this.config.api_key,
format: this.config.format,
x_login: x_login,
x_apiKey: x_apiKey
link: link
};
return this._doRequest(this._generateNiceUrl(query, 'validate'), cb);
// We can use an array of fields and matching values to edit multiple metadata fields or strings to edit only a
// single one
if(Array.isArray(metadata_field) && Array.isArray(new_value)) {
query['edit'] = metadata_field.join(',');
metadata_field.forEach(function mapMetadataToValue(field, index) {
query[field] = new_value[index];
});
} else {
query['edit'] = metadata_field;
query[metadata_field] = new_value;
}
return this._doRequest(this._generateNiceUrl(query, 'user/link_edit'), cb);
};

@@ -403,0 +398,0 @@

@@ -10,3 +10,3 @@ {

],
"version": "2.0.0",
"version": "3.0.0",
"author": "Tane Piper <piper.tane@gmail.com>",

@@ -27,2 +27,6 @@ "contributors": [

"name": "jessefulton"
},
{
"name": "coaxial",
"email": "coaxial@cxial.tk"
}

@@ -38,6 +42,7 @@ ],

"scripts": {
"test": "node_modules/.bin/nodeunit test"
"test": "VCR_MODE=cache node_modules/.bin/nodeunit test"
},
"devDependencies": {
"nodeunit": "^0.9.1"
"nodeunit": "^0.9.1",
"sepia": "^2.0.1"
},

@@ -44,0 +49,0 @@ "dependencies": {

@@ -54,8 +54,6 @@ node-bitly - Bitly API for nodejs

---------------
Currently this module does NOT support the OAuth features of the Bitly API. As such
this module is limited to the following API methods:
This module is limited to the following API methods:
* shorten
* expand
* validate
* clicks / clicks_by_minute / clicks_by_day

@@ -67,1 +65,2 @@ * referrers

* info
* link_edit
var Bitly = require('../');
var sepia = require('sepia');
var bitly_user = 'bitlynodejs';
var bitly_key = 'R_8a2a91d31932dc7fda5468033dfe3c15';
var bitly_token = 'eb1b99efe83c7d029e7600a6b38e32d1c9c2c6d9';
var bitly;
var LONG_URL = 'http://example.com/';
var SHORT_URL = 'http://bit.ly/1KjIwXl';
var BITLY_HASH = 'VDcn';
module.exports = {
'setUp': function(callback) {
bitly = new Bitly(bitly_token);
callback();
},
module.exports = {
'test valid url': function(test) {
var bitly = new Bitly(bitly_user, bitly_key);
test.ok(true, bitly._urlCheck('http://tanepiper.com/test?q=test'));
'tearDown': function(callback) {
bitly = undefined;
callback();
},
'Test valid url': function(test) {
test.ok(true, bitly._urlCheck(LONG_URL));
test.done();
},
'shorten url with callback': function(test) {
var bitly = new Bitly(bitly_user, bitly_key);
bitly.shorten('http://tanepiper.com', function(error, result) {
'Shorten url with callback': function(test) {
bitly.shorten(LONG_URL, function(error, result) {
test.ifError(error);

@@ -23,5 +34,4 @@ test.deepEqual(result.status_code, 200);

'shorten url with promise': function(test) {
var bitly = new Bitly(bitly_user, bitly_key);
bitly.shorten('http://tanepiper.com').then(function(result) {
'Shorten url with promise': function(test) {
bitly.shorten(LONG_URL).then(function(result) {
test.deepEqual(result.status_code, 200);

@@ -36,3 +46,2 @@ test.done();

'Check info on bitly pro-domain with callback': function(test) {
var bitly = new Bitly(bitly_user, bitly_key);
bitly.bitlyProDomain('nyti.ms', function(error, result) {

@@ -46,3 +55,2 @@ test.ifError(error);

'Check info on bitly pro-domain with promise': function(test) {
var bitly = new Bitly(bitly_user, bitly_key);
bitly.bitlyProDomain('nyti.ms').then(function(result) {

@@ -58,4 +66,3 @@ test.deepEqual(result.status_code, 200);

'Get info about single short url with callback': function(test) {
var bitly = new Bitly(bitly_user, bitly_key);
bitly.info('http://bit.ly/9lCnZ9', function(error, result) {
bitly.info(SHORT_URL, function(error, result) {
test.ifError(error);

@@ -68,4 +75,3 @@ test.deepEqual(result.status_code, 200);

'Get info about single short url with promise': function(test) {
var bitly = new Bitly(bitly_user, bitly_key);
bitly.info('http://bit.ly/9lCnZ9').then(function(result) {
bitly.info(SHORT_URL).then(function(result) {
test.deepEqual(result.status_code, 200);

@@ -80,4 +86,3 @@ test.done();

'Get info about single hash with callback': function(test) {
var bitly = new Bitly(bitly_user, bitly_key);
bitly.info('6uBruH', function(error, result) {
bitly.info(BITLY_HASH, function(error, result) {
test.ifError(error);

@@ -90,4 +95,3 @@ test.deepEqual(result.status_code, 200);

'Get info about single hash with promise': function(test) {
var bitly = new Bitly(bitly_user, bitly_key);
bitly.info('6uBruH').then(function(result) {
bitly.info(BITLY_HASH).then(function(result) {
test.deepEqual(result.status_code, 200);

@@ -102,4 +106,3 @@ test.done();

'Get info about mixed url and hash with callback': function(test) {
var bitly = new Bitly(bitly_user, bitly_key);
bitly.info(['http://bit.ly/9lCnZ9', '6uBruH'], function(error, result) {
bitly.info([SHORT_URL, BITLY_HASH], function(error, result) {
test.ifError(error);

@@ -112,4 +115,3 @@ test.deepEqual(result.status_code, 200);

'Get info about mixed url and hash with promise': function(test) {
var bitly = new Bitly(bitly_user, bitly_key);
bitly.info(['http://bit.ly/9lCnZ9', '6uBruH']).then(function(result) {
bitly.info([SHORT_URL, BITLY_HASH]).then(function(result) {
test.deepEqual(result.status_code, 200);

@@ -124,4 +126,3 @@ test.done();

'Get clicks for single short url with callback': function(test) {
var bitly = new Bitly(bitly_user, bitly_key);
bitly.clicks('http://bit.ly/9lCnZ9', function(error, result) {
bitly.clicks(SHORT_URL, function(error, result) {
test.ifError(error);

@@ -134,4 +135,3 @@ test.deepEqual(result.status_code, 200);

'Get clicks for single short url with promise': function(test) {
var bitly = new Bitly(bitly_user, bitly_key);
bitly.clicks('http://bit.ly/9lCnZ9').then(function(result) {
bitly.clicks(SHORT_URL).then(function(result) {
test.deepEqual(result.status_code, 200);

@@ -146,4 +146,3 @@ test.done();

'Get clicks for single hash with callback': function(test) {
var bitly = new Bitly(bitly_user, bitly_key);
bitly.clicks('6uBruH', function(error, result) {
bitly.clicks(BITLY_HASH, function(error, result) {
test.ifError(error);

@@ -156,4 +155,3 @@ test.deepEqual(result.status_code, 200);

'Get clicks for single hash with promise': function(test) {
var bitly = new Bitly(bitly_user, bitly_key);
bitly.clicks('6uBruH').then(function(result) {
bitly.clicks(BITLY_HASH).then(function(result) {
test.deepEqual(result.status_code, 200);

@@ -168,4 +166,3 @@ test.done();

'Get clicks for mixed url and hash with callback': function(test) {
var bitly = new Bitly(bitly_user, bitly_key);
bitly.clicks(['http://bit.ly/9lCnZ9', '6uBruH'], function(error, result) {
bitly.clicks([SHORT_URL, BITLY_HASH], function(error, result) {
test.ifError(error);

@@ -178,4 +175,3 @@ test.deepEqual(result.status_code, 200);

'Get clicks for mixed url and hash with promise': function(test) {
var bitly = new Bitly(bitly_user, bitly_key);
bitly.clicks(['http://bit.ly/9lCnZ9', '6uBruH']).then(function(result) {
bitly.clicks([SHORT_URL, BITLY_HASH]).then(function(result) {
test.deepEqual(result.status_code, 200);

@@ -190,4 +186,3 @@ test.done();

'Get clicks by minute for single short url with callback': function(test) {
var bitly = new Bitly(bitly_user, bitly_key);
bitly.clicksByMinute('http://bit.ly/9lCnZ9', function(error, result) {
bitly.clicksByMinute(SHORT_URL, function(error, result) {
test.ifError(error);

@@ -200,4 +195,3 @@ test.deepEqual(result.status_code, 200);

'Get clicks by minute for single short url with promise': function(test) {
var bitly = new Bitly(bitly_user, bitly_key);
bitly.clicksByMinute('http://bit.ly/9lCnZ9').then(function(result) {
bitly.clicksByMinute(SHORT_URL).then(function(result) {
test.deepEqual(result.status_code, 200);

@@ -212,4 +206,3 @@ test.done();

'Get clicks by minute for single hash with callback': function(test) {
var bitly = new Bitly(bitly_user, bitly_key);
bitly.clicksByMinute('6uBruH', function(error, result) {
bitly.clicksByMinute(BITLY_HASH, function(error, result) {
test.ifError(error);

@@ -222,4 +215,3 @@ test.deepEqual(result.status_code, 200);

'Get clicks by minute for single hash with promise': function(test) {
var bitly = new Bitly(bitly_user, bitly_key);
bitly.clicksByMinute('6uBruH').then(function(result) {
bitly.clicksByMinute(BITLY_HASH).then(function(result) {
test.deepEqual(result.status_code, 200);

@@ -234,4 +226,3 @@ test.done();

'Get clicks by minute for mixed url and hash with callback': function(test) {
var bitly = new Bitly(bitly_user, bitly_key);
bitly.clicksByMinute(['http://bit.ly/9lCnZ9', '6uBruH'], function(error, result) {
bitly.clicksByMinute([SHORT_URL, BITLY_HASH], function(error, result) {
test.ifError(error);

@@ -244,4 +235,3 @@ test.deepEqual(result.status_code, 200);

'Get clicks by minute for mixed url and hash with promise': function(test) {
var bitly = new Bitly(bitly_user, bitly_key);
bitly.clicksByMinute(['http://bit.ly/9lCnZ9', '6uBruH']).then(function(result) {
bitly.clicksByMinute([SHORT_URL, BITLY_HASH]).then(function(result) {
test.deepEqual(result.status_code, 200);

@@ -256,4 +246,3 @@ test.done();

'Get clicks by day for single short url with callback': function(test) {
var bitly = new Bitly(bitly_user, bitly_key);
bitly.clicksByDay('http://bit.ly/9lCnZ9', function(error, result) {
bitly.clicksByDay(SHORT_URL, function(error, result) {
test.ifError(error);

@@ -266,4 +255,3 @@ test.deepEqual(result.status_code, 200);

'Get clicks by day for single short url with promise': function(test) {
var bitly = new Bitly(bitly_user, bitly_key);
bitly.clicksByDay('http://bit.ly/9lCnZ9').then(function(result) {
bitly.clicksByDay(SHORT_URL).then(function(result) {
test.deepEqual(result.status_code, 200);

@@ -278,4 +266,3 @@ test.done();

'Get clicks by day for single hash with callback': function(test) {
var bitly = new Bitly(bitly_user, bitly_key);
bitly.clicksByDay('6uBruH', function(error, result) {
bitly.clicksByDay(BITLY_HASH, function(error, result) {
test.ifError(error);

@@ -288,4 +275,3 @@ test.deepEqual(result.status_code, 200);

'Get clicks by day for single hash with promise': function(test) {
var bitly = new Bitly(bitly_user, bitly_key);
bitly.clicksByDay('6uBruH').then(function(result) {
bitly.clicksByDay(BITLY_HASH).then(function(result) {
test.deepEqual(result.status_code, 200);

@@ -300,4 +286,3 @@ test.done();

'Get clicks by day for mixed url and hash with callback': function(test) {
var bitly = new Bitly(bitly_user, bitly_key);
bitly.clicksByDay(['http://bit.ly/9lCnZ9', '6uBruH'], function(error, result) {
bitly.clicksByDay([SHORT_URL, BITLY_HASH], function(error, result) {
test.ifError(error);

@@ -310,4 +295,3 @@ test.deepEqual(result.status_code, 200);

'Get clicks by day for mixed url and hash with promise': function(test) {
var bitly = new Bitly(bitly_user, bitly_key);
bitly.clicksByDay(['http://bit.ly/9lCnZ9', '6uBruH']).then(function(result) {
bitly.clicksByDay([SHORT_URL, BITLY_HASH]).then(function(result) {
test.deepEqual(result.status_code, 200);

@@ -323,4 +307,3 @@ test.done();

'Get referrers for single short url with callback': function(test) {
var bitly = new Bitly(bitly_user, bitly_key);
bitly.referrers('http://bit.ly/9lCnZ9', function(error, result) {
bitly.referrers(SHORT_URL, function(error, result) {
test.ifError(error);

@@ -333,4 +316,3 @@ test.deepEqual(result.status_code, 200);

'Get referrers for single short url with promise': function(test) {
var bitly = new Bitly(bitly_user, bitly_key);
bitly.referrers('http://bit.ly/9lCnZ9').then(function(result) {
bitly.referrers(SHORT_URL).then(function(result) {
test.deepEqual(result.status_code, 200);

@@ -345,4 +327,3 @@ test.done();

'Get referrers for single hash with callback': function(test) {
var bitly = new Bitly(bitly_user, bitly_key);
bitly.referrers('6uBruH', function(error, result) {
bitly.referrers(BITLY_HASH, function(error, result) {
test.ifError(error);

@@ -355,4 +336,3 @@ test.deepEqual(result.status_code, 200);

'Get referrers for single hash with promise': function(test) {
var bitly = new Bitly(bitly_user, bitly_key);
bitly.referrers('6uBruH').then(function(result) {
bitly.referrers(BITLY_HASH).then(function(result) {
test.deepEqual(result.status_code, 200);

@@ -367,4 +347,3 @@ test.done();

'Get countries for single short url with callback': function(test) {
var bitly = new Bitly(bitly_user, bitly_key);
bitly.countries('http://bit.ly/9lCnZ9', function(error, result) {
bitly.countries(SHORT_URL, function(error, result) {
test.ifError(error);

@@ -377,4 +356,3 @@ test.deepEqual(result.status_code, 200);

'Get countries for single short url with promise': function(test) {
var bitly = new Bitly(bitly_user, bitly_key);
bitly.countries('http://bit.ly/9lCnZ9').then(function(result) {
bitly.countries(SHORT_URL).then(function(result) {
test.deepEqual(result.status_code, 200);

@@ -390,4 +368,3 @@ test.done();

'Get countries for single hash with callback': function(test) {
var bitly = new Bitly(bitly_user, bitly_key);
bitly.countries('6uBruH', function(error, result) {
bitly.countries(BITLY_HASH, function(error, result) {
test.ifError(error);

@@ -400,4 +377,3 @@ test.deepEqual(result.status_code, 200);

'Get countries for single hash with promise': function(test) {
var bitly = new Bitly(bitly_user, bitly_key);
bitly.countries('6uBruH').then(function(result) {
bitly.countries(BITLY_HASH).then(function(result) {
test.deepEqual(result.status_code, 200);

@@ -412,4 +388,3 @@ test.done();

'Look up information about 1 long url with callback': function(test) {
var bitly = new Bitly(bitly_user, bitly_key);
bitly.lookup('http://tanepiper.com', function(error, result) {
bitly.lookup(LONG_URL, function(error, result) {
test.ifError(error);

@@ -422,4 +397,3 @@ test.deepEqual(result.status_code, 200);

'Look up information about 1 long url with promise': function(test) {
var bitly = new Bitly(bitly_user, bitly_key);
bitly.lookup('http://tanepiper.com').then(function(result) {
bitly.lookup(LONG_URL).then(function(result) {
test.deepEqual(result.status_code, 200);

@@ -434,4 +408,3 @@ test.done();

'Look up information about multiple long url with callback': function(test) {
var bitly = new Bitly(bitly_user, bitly_key);
bitly.lookup(['http://tanepiper.com', 'http://nodejs.org'], function(error, result) {
bitly.lookup([LONG_URL, 'http://nodejs.org'], function(error, result) {
test.ifError(error);

@@ -444,4 +417,3 @@ test.deepEqual(result.status_code, 200);

'Look up information about multiple long url with promise': function(test) {
var bitly = new Bitly(bitly_user, bitly_key);
bitly.lookup(['http://tanepiper.com', 'http://nodejs.org']).then(function(result) {
bitly.lookup([LONG_URL, 'http://nodejs.org']).then(function(result) {
test.deepEqual(result.status_code, 200);

@@ -456,4 +428,3 @@ test.done();

'Expand for single short url with callback': function(test) {
var bitly = new Bitly(bitly_user, bitly_key);
bitly.expand('http://bit.ly/9lCnZ9', function(error, result) {
bitly.expand(SHORT_URL, function(error, result) {
test.ifError(error);

@@ -466,4 +437,3 @@ test.deepEqual(result.status_code, 200);

'Expand for single short url with promise': function(test) {
var bitly = new Bitly(bitly_user, bitly_key);
bitly.expand('http://bit.ly/9lCnZ9').then(function(result) {
bitly.expand(SHORT_URL).then(function(result) {
test.deepEqual(result.status_code, 200);

@@ -479,4 +449,3 @@ test.done();

'Expand for single hash with callback': function(test) {
var bitly = new Bitly(bitly_user, bitly_key);
bitly.expand('6uBruH', function(error, result) {
bitly.expand(BITLY_HASH, function(error, result) {
test.ifError(error);

@@ -489,4 +458,3 @@ test.deepEqual(result.status_code, 200);

'Expand for single hash with promise': function(test) {
var bitly = new Bitly(bitly_user, bitly_key);
bitly.expand('6uBruH').then(function(result) {
bitly.expand(BITLY_HASH).then(function(result) {
test.deepEqual(result.status_code, 200);

@@ -501,4 +469,3 @@ test.done();

'Expand for mixed url and hash with callback': function(test) {
var bitly = new Bitly(bitly_user, bitly_key);
bitly.expand(['http://bit.ly/9lCnZ9', '6uBruH'], function(error, result) {
bitly.expand([SHORT_URL, BITLY_HASH], function(error, result) {
test.ifError(error);

@@ -511,4 +478,3 @@ test.deepEqual(result.status_code, 200);

'Expand for mixed url and hash with promise': function(test) {
var bitly = new Bitly(bitly_user, bitly_key);
bitly.expand(['http://bit.ly/9lCnZ9', '6uBruH']).then(function(result) {
bitly.expand([SHORT_URL, BITLY_HASH]).then(function(result) {
test.deepEqual(result.status_code, 200);

@@ -522,6 +488,14 @@ test.done();

'Edit the title of an existing link': function(test) {
test.expect(2);
bitly.linkEdit('title', SHORT_URL, 'Edited title', function(error, result) {
test.ifError(error);
test.deepEqual(result.status_code, 200);
test.done();
});
},
'Validate any bitly user and API key with callback': function(test) {
var bitly = new Bitly(bitly_user, bitly_key);
bitly.validate(bitly_user, bitly_key, function(error, result) {
'Edit the note of an existing link': function(test) {
test.expect(2);
bitly.linkEdit('note', SHORT_URL, 'Edited note', function(error, result) {
test.ifError(error);

@@ -533,9 +507,16 @@ test.deepEqual(result.status_code, 200);

'Validate any bitly user and API key with promise': function(test) {
var bitly = new Bitly(bitly_user, bitly_key);
bitly.validate(bitly_user, bitly_key).then(function(result) {
'Edit the private status of an existing link': function(test) {
test.expect(2);
bitly.linkEdit('private', SHORT_URL, 'true', function(error, result) {
test.ifError(error);
test.deepEqual(result.status_code, 200);
test.done();
}, function(error) {
});
},
'Edit the user timestamp of an existing link': function(test) {
test.expect(2);
bitly.linkEdit('user_ts', SHORT_URL, '522585000', function(error, result) {
test.ifError(error);
test.deepEqual(result.status_code, 200);
test.done();

@@ -545,6 +526,7 @@ });

'Return error on invalid API key with callback': function(test) {
var bitly = new Bitly(bitly_user, 'xxxxxx');
bitly.validate(bitly_user, bitly_key, function(error, result) {
test.throws(error);
'Edit the archived status of an existing link': function(test) {
test.expect(2);
bitly.linkEdit('archived', SHORT_URL, 'true', function(error, result) {
test.ifError(error);
test.deepEqual(result.status_code, 200);
test.done();

@@ -554,12 +536,24 @@ });

'Return error on invalid API key with promise': function(test) {
var bitly = new Bitly(bitly_user, 'xxxxxx');
bitly.validate(bitly_user, bitly_key).then(function(result) {
// None
}, function(error) {
test.throws(error);
'Takes an array of metadata to edit': function(test) {
test.expect(2);
bitly.linkEdit(['title', 'note'], SHORT_URL, ['new title', 'new note'], function(error, result) {
test.ifError(error);
test.deepEqual(result.status_code, 200);
test.done();
});
},
"Throws if trying to edit a non existent link": function(test) {
test.expect(1);
test.throws(bitly.linkEdit('tite', 'http://bit.ly/invalidhash', 'new title', function(error, result) {
test.done();
}));
},
"Throws if trying to edit a non existent metadata parameter": function(test) {
test.expect(1);
test.throws(bitly.linkEdit('normality', SHORT_URL, 'restored', function(error, result) {
test.done();
}));
}
};

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc