Socket
Socket
Sign inDemoInstall

api-client-node

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

api-client-node - npm Package Compare versions

Comparing version 1.0.7 to 1.0.8

60

dist/event/index.js

@@ -205,4 +205,64 @@ 'use strict';

}()
}, {
key: 'getEventCategories',
value: function () {
var _ref12 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee6() {
var resp;
return _regenerator2.default.wrap(function _callee6$(_context6) {
while (1) {
switch (_context6.prev = _context6.next) {
case 0:
_context6.next = 2;
return this.instance.get('/events/categories');
case 2:
resp = _context6.sent.data;
return _context6.abrupt('return', resp);
case 4:
case 'end':
return _context6.stop();
}
}
}, _callee6, this);
}));
function getEventCategories() {
return _ref12.apply(this, arguments);
}
return getEventCategories;
}()
}, {
key: 'getEventSubCategories',
value: function () {
var _ref13 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee7() {
var resp;
return _regenerator2.default.wrap(function _callee7$(_context7) {
while (1) {
switch (_context7.prev = _context7.next) {
case 0:
_context7.next = 2;
return this.instance.get('/events/subcategories');
case 2:
resp = _context7.sent.data;
return _context7.abrupt('return', resp);
case 4:
case 'end':
return _context7.stop();
}
}
}, _callee7, this);
}));
function getEventSubCategories() {
return _ref13.apply(this, arguments);
}
return getEventSubCategories;
}()
}]);
return Event;
}();

115

dist/event/index.spec.js

@@ -31,2 +31,4 @@ 'use strict';

t.context.token = 'sampleToken';
t.context.categories = ['culture', 'explore'];
t.context.subcategories = ['art', 'opinion', 'food'];
t.context.event = {

@@ -43,3 +45,3 @@ id: 'sample-event-id',

case 3:
case 5:
case 'end':

@@ -128,5 +130,5 @@ return _context.stop();

(0, _ava2.default)('test getEvents', function () {
(0, _ava2.default)('test getEventCategories', function () {
var _ref4 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee4(t) {
var api, token, filter, event, resp;
var api, token, event, resp;
return _regenerator2.default.wrap(function _callee4$(_context4) {

@@ -136,14 +138,14 @@ while (1) {

case 0:
(0, _nock2.default)(t.context.api).get('/api/events').query({ start_time: t.context.event.start_time }).reply(200, [t.context.event]);
(0, _nock2.default)(t.context.api).get('/api/events/categories').reply(200, t.context.categories);
api = t.context.api;
token = t.context.token;
filter = { start_time: t.context.event.start_time };
event = new _index.Event({ api: api, token: token });
_context4.next = 7;
return event.getEvents({ filter: filter });
_context4.next = 6;
return event.getEventCategories();
case 7:
case 6:
resp = _context4.sent;
t.deepEqual(resp, [t.context.event]);
console.log({ resp: resp, msg: 'the resp from getEventCategories' });
t.deepEqual(resp, t.context.categories);

@@ -163,5 +165,5 @@ case 9:

(0, _ava2.default)('test updateEvent', function () {
(0, _ava2.default)('test getEventSubCategories', function () {
var _ref5 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee5(t) {
var api, token, event, id, resp;
var api, token, event, resp;
return _regenerator2.default.wrap(function _callee5$(_context5) {

@@ -171,16 +173,15 @@ while (1) {

case 0:
(0, _nock2.default)(t.context.api).post('/api/events/' + t.context.event.id, t.context.event).reply(200, t.context.event);
(0, _nock2.default)(t.context.api).get('/api/events/subcategories').reply(200, t.context.subcategories);
api = t.context.api;
token = t.context.token;
event = new _index.Event({ api: api, token: token });
id = t.context.event.id;
_context5.next = 7;
return event.updateEvent({ id: id, updates: t.context.event });
_context5.next = 6;
return event.getEventSubCategories();
case 7:
case 6:
resp = _context5.sent;
t.deepEqual(resp, t.context.event);
t.deepEqual(resp, t.context.subcategories);
case 9:
case 8:
case 'end':

@@ -198,5 +199,5 @@ return _context5.stop();

(0, _ava2.default)('test deleteEvent', function () {
(0, _ava2.default)('test getEvents', function () {
var _ref6 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee6(t) {
var api, token, event, id, resp;
var api, token, filter, event, resp;
return _regenerator2.default.wrap(function _callee6$(_context6) {

@@ -206,9 +207,9 @@ while (1) {

case 0:
(0, _nock2.default)(t.context.api).delete('/api/events/' + t.context.event.id).reply(202, t.context.event);
(0, _nock2.default)(t.context.api).get('/api/events').query({ start_time: t.context.event.start_time }).reply(200, [t.context.event]);
api = t.context.api;
token = t.context.token;
filter = { start_time: t.context.event.start_time };
event = new _index.Event({ api: api, token: token });
id = t.context.event.id;
_context6.next = 7;
return event.deleteEvent({ id: id });
return event.getEvents({ filter: filter });

@@ -218,3 +219,3 @@ case 7:

t.truthy(resp, 'Has just deleted');
t.deepEqual(resp, [t.context.event]);

@@ -232,2 +233,68 @@ case 9:

};
}());
(0, _ava2.default)('test updateEvent', function () {
var _ref7 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee7(t) {
var api, token, event, id, resp;
return _regenerator2.default.wrap(function _callee7$(_context7) {
while (1) {
switch (_context7.prev = _context7.next) {
case 0:
(0, _nock2.default)(t.context.api).post('/api/events/' + t.context.event.id, t.context.event).reply(200, t.context.event);
api = t.context.api;
token = t.context.token;
event = new _index.Event({ api: api, token: token });
id = t.context.event.id;
_context7.next = 7;
return event.updateEvent({ id: id, updates: t.context.event });
case 7:
resp = _context7.sent;
t.deepEqual(resp, t.context.event);
case 9:
case 'end':
return _context7.stop();
}
}
}, _callee7, undefined);
}));
return function (_x7) {
return _ref7.apply(this, arguments);
};
}());
(0, _ava2.default)('test deleteEvent', function () {
var _ref8 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee8(t) {
var api, token, event, id, resp;
return _regenerator2.default.wrap(function _callee8$(_context8) {
while (1) {
switch (_context8.prev = _context8.next) {
case 0:
(0, _nock2.default)(t.context.api).delete('/api/events/' + t.context.event.id).reply(202, t.context.event);
api = t.context.api;
token = t.context.token;
event = new _index.Event({ api: api, token: token });
id = t.context.event.id;
_context8.next = 7;
return event.deleteEvent({ id: id });
case 7:
resp = _context8.sent;
t.truthy(resp, 'Has just deleted');
case 9:
case 'end':
return _context8.stop();
}
}
}, _callee8, undefined);
}));
return function (_x8) {
return _ref8.apply(this, arguments);
};
}());
{
"name": "api-client-node",
"version": "1.0.7",
"version": "1.0.8",
"description": "The official vibely node api client",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

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