New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@riiid/santa-sdk-js

Package Overview
Dependencies
Maintainers
2
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@riiid/santa-sdk-js - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

9

lib/__tests__/request-test.js

@@ -14,9 +14,10 @@ const Request = require('../request');

test('_get no path', () => {
expect(() => req._get('')).toThrowError('path must be defined.');
test('__reqTwoParams no path', () => {
expect(() => req.__reqTwoParams('')).toThrowError('path must be defined.');
});
test('__getReq no path', () => {
expect(() => req.__getReq('POST')).toThrowError('path must be defined.');
test('__reqThreeParams no path', () => {
expect(() => req.__reqThreeParams('POST'))
.toThrowError('path must be defined.');
});
});

@@ -75,2 +75,25 @@ const nock = require('nock');

test('deleteUser token must be defined', () => {
expect(() => req.deleteUser()).toThrowError('token must be defined');
});
test('deleteUser failed', () => {
nock(BASE_URL)
.delete(PATH_USER)
.reply(500);
return req.deleteUser(token).catch(err => {
expect(err.message).toMatchSnapshot();
});
});
test('deleteUser$ failed', done => {
nock(BASE_URL)
.delete(PATH_USER)
.reply(500);
return req.deleteUser$(token).subscribe(null, err => {
expect(err.message).toMatchSnapshot();
done();
});
});
test('signupWithEmail email, password must be defined', () => {

@@ -143,3 +166,3 @@ expect(() => req.signupWithEmail({}))

nock(BASE_URL)
.post(PATH_KAKAO, {kakao_code: snsToken})
.post(PATH_KAKAO, {kakao_token: snsToken})
.reply(500);

@@ -170,3 +193,3 @@ return req.getTokenWithSNS({token, snsToken, type: 'kakao'})

nock(BASE_URL)
.post(PATH_KAKAO, {kakao_code: snsToken})
.post(PATH_KAKAO, {kakao_token: snsToken})
.reply(500);

@@ -173,0 +196,0 @@ return req.getTokenWithSNS$({token, snsToken, type: 'kakao'})

@@ -37,2 +37,13 @@ const {from} = require('rxjs');

deleteUser(token) {
if (!token) {
throw new Error('token must be defined');
}
return this._delete(PATH_USER, null, this._token(token));
}
deleteUser$(token) {
return from(this.deleteUser(token));
}
signupWithEmail({email, password, token = ''}) {

@@ -70,3 +81,3 @@ if (!email || !password) {

case 'kakao':
return this._post(PATH_KAKAO, {kakao_code: snsToken},
return this._post(PATH_KAKAO, {kakao_token: snsToken},
{...!!token && this._token(token)});

@@ -73,0 +84,0 @@ default:

@@ -21,6 +21,11 @@ const axios = require('axios');

_get(path, queryString = {}, config = {}) {
__reqTwoParams(method = 'GET', path, queryString = {}, config = {}) {
if (!path) {
throw new Error('path must be defined.');
}
let _req = this._req;
switch (method) {
case 'DELETE': _req = _req.delete; break;
default: _req = _req.get; break;
}
const _config = {

@@ -30,6 +35,6 @@ params: {...queryString},

};
return this._req.get(path, _config);
return _req(path, _config);
}
__getReq(method = 'POST', path, data, config) {
__reqThreeParams(method = 'POST', path, data, config) {
if (!path) {

@@ -41,3 +46,2 @@ throw new Error('path must be defined.');

case 'PATCH': _req = _req.patch; break;
case 'DELETE': _req = _req.delete; break;
default: _req = _req.post; break;

@@ -49,13 +53,17 @@ }

_get(path, queryString, config = {}) {
return this.__reqTwoParams('GET', path, queryString, config);
}
_delete(path, queryString, config = {}) {
return this.__reqTwoParams('DELETE', path, queryString, config);
}
_post(path, data, config = {}) {
return this.__getReq('POST', path, data, config);
return this.__reqThreeParams('POST', path, data, config);
}
_patch(path, data, config = {}) {
return this.__getReq('PATCH', path, data, config);
return this.__reqThreeParams('PATCH', path, data, config);
}
_delete(path, data, config = {}) {
return this.__getReq('DELETE', path, data, config);
}
}
{
"name": "@riiid/santa-sdk-js",
"version": "0.0.4",
"version": "0.0.5",
"description": "Santa SDK for Javascript",

@@ -10,3 +10,4 @@ "main": "./lib/index.js",

"scripts": {
"test": "jest --coverage"
"test": "jest --coverage",
"test:watch": "jest --coverage --watch --notify"
},

@@ -13,0 +14,0 @@ "engines": {

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