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

amplitude

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

amplitude - npm Package Compare versions

Comparing version 1.0.6 to 1.0.7

tasks/gulp-build.js

11

gulpfile.js

@@ -1,8 +0,3 @@

var gulp = require('gulp');
var babel = require('gulp-babel');
gulp.task('default', function () {
return gulp.src('./src/amplitude.js')
.pipe(babel())
.pipe(gulp.dest('lib'));
});
require('babel/register');
require('glob').sync('./tasks/gulp-*').forEach(require);
require('gulp').task('default', ['build:watch']);

@@ -50,5 +50,5 @@ 'use strict';

console.error('There was a problem tracking "' + data.event_type + '" for "' + name + '"; ' + err);
cb(err);
cb(err, res.body);
} else if (cb) {
cb(res.body);
cb(null, res.body);
}

@@ -55,0 +55,0 @@ });

{
"name": "amplitude",
"version": "1.0.6",
"version": "1.0.7",
"description": "A node wrapper for Amplitude analytics http api",
"author": "Blade Barringer <blade@crookedneighbor.com>",
"contributors": [
{
"name": "Erki Esken",
"email": "erki@deekit.net",
"url": "http://deekit.net/"
}
],
"scripts": {
"compile": "node_modules/.bin/gulp",
"compile": "node_modules/.bin/gulp build",
"prepublish": "npm run compile",

@@ -29,2 +36,3 @@ "test": "mocha"

"chai": "^3.0.0",
"glob": "^5.0.14",
"gulp": "^3.9.0",

@@ -31,0 +39,0 @@ "gulp-babel": "^5.1.0",

@@ -28,7 +28,7 @@ # amplitude

event_type: "some value", // required
event_properties: {
//...
event_properties: {
//...
},
user_properties: {
//...
user_properties: {
//...
}

@@ -42,3 +42,3 @@ }

```javascript
amplitude.track(data, function(error) {
amplitude.track(data, function(error, resBody) {
// If post was succesful, error will be null

@@ -48,1 +48,6 @@ //... do something

```
<!---
Do not change anything below this comment. It is generated automatically.
------>

@@ -21,4 +21,8 @@ let nock = require('nock');

beforeEach(() => {
nock(api_url).post(stringified_url)
.reply(200);
nock(api_url)
.defaultReplyHeaders({ 'Content-Type': 'application/json' })
.post(stringified_url)
.reply(function () {
return [200, JSON.stringify({ some: 'data' })];
});
});

@@ -29,7 +33,17 @@

amplitude.track(data, () => {
amplitude.track(data, (err) => {
expect(console.error).to.not.be.called;
expect(err).to.be.a('null');
done();
});
});
it('passes response data', (done) => {
let data = { event_type: 'event' };
amplitude.track(data, (err, data) => {
expect(data).to.include.keys('some');
done();
});
});
});

@@ -41,14 +55,26 @@

beforeEach(() => {
nock(api_url).post(stringified_url)
.replyWithError('not succesful');
nock(api_url)
.defaultReplyHeaders({ 'Content-Type': 'application/json' })
.post(stringified_url)
.reply(function () {
return [500, { message: 'not successful' }];
})
});
it('logs error', (done) => {
amplitude.track(data, () => {
amplitude.track(data, (err, data) => {
expect(console.error).to.be.calledOnce;
expect(console.error).to.be.calledWith('There was a problem tracking "event" for "unique_user_id"; Error: not succesful');
expect(console.error).to.be.calledWith('There was a problem tracking "event" for "unique_user_id"; Error: Internal Server Error');
done();
});
});
it('passes error response data', (done) => {
amplitude.track(data, (err, data) => {
expect(data).to.include.keys('message');
expect(data.message).to.equal('not successful');
done();
});
});
});
});
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