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

@availity/api-core

Package Overview
Dependencies
Maintainers
5
Versions
121
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@availity/api-core - npm Package Compare versions

Comparing version 1.0.0-alpha.9 to 1.0.0-alpha.10

src/resources/notifications.js

6

package.json
{
"name": "@availity/api-core",
"version": "1.0.0-alpha.9",
"version": "1.0.0-alpha.10",
"description": "Base API definitions for the Availity REST API",

@@ -17,6 +17,6 @@ "keywords": [

"peerDependencies": {
"@availity/localstorage-core": "^1.0.0-alpha.9"
"@availity/localstorage-core": "^1.0.0-alpha.10"
},
"devDependencies": {
"@availity/localstorage-core": "^1.0.0-alpha.9"
"@availity/localstorage-core": "^1.0.0-alpha.10"
},

@@ -23,0 +23,0 @@ "publishConfig": {

@@ -237,4 +237,4 @@ import AvLocalStorage from '@availity/localstorage-core';

put(id, data, config) {
return this.update(id, data, config);
put(...args) {
return this.update(args);
}

@@ -244,5 +244,4 @@

remove(id, config) {
let data;
if (typeof id !== 'string' && typeof id !== 'number') {
data = id;
config = id;
id = '';

@@ -253,7 +252,6 @@ }

config.url = this.getUrl(config, id);
config.data = data;
const beforeFunc = this.beforeRemove || this.beforeDelete;
if (beforeFunc) {
config.data = beforeFunc(config.data);
config = beforeFunc(config);
}

@@ -263,5 +261,5 @@ return this.request(config, this.afterRemove || this.afterDelete);

delete(id, config) {
return this.remove(id, config);
delete(...args) {
return this.remove(args);
}
}
import AvApi from './api';
import AvLogMessages from './resources/logs';
import AvNavigation from './resources/navigation';
import AvNotification from './resources/notification';
import AvNotification from './resources/notifications';
import AvOrganizations from './resources/organizations';

@@ -6,0 +6,0 @@ import AvPermissions from './resources/permissions';

@@ -722,44 +722,32 @@ import AvApi from '../api';

test('remove() should set first argument as data if not string or number', () => {
test('remove() should set first argument as config if not string or number', () => {
const config = {
testValue: 'test',
method: 'DELETE',
url: testUrl,
data: {
a: '1',
b: '2',
},
};
const data = {
testData: 'data',
};
const expectedConfig = Object.assign(
{
method: 'DELETE',
url: testUrl,
},
config,
{ data }
);
api.remove(data, config);
expect(api.getUrl).toHaveBeenLastCalledWith(expectedConfig, '');
expect(api.request).toHaveBeenLastCalledWith(expectedConfig, undefined);
api.remove(config);
expect(api.getUrl).toHaveBeenLastCalledWith(config, '');
expect(api.request).toHaveBeenLastCalledWith(config, undefined);
});
test('remove() should run data through beforeRemove if defined', () => {
test('remove() should call beforeRemove() if defined', () => {
const config = {
testValue: 'test',
method: 'DELETE',
url: testUrl,
data: {
a: '1',
b: '2',
},
};
const data = {
testData: 'data',
};
const expectedConfig = Object.assign(
{
method: 'DELETE',
url: testUrl,
},
config,
{ data }
);
api.beforeRemove = jest.fn(thisData => thisData);
api.remove(data, config);
expect(api.getUrl).toHaveBeenLastCalledWith(expectedConfig, '');
expect(api.request).toHaveBeenLastCalledWith(expectedConfig, undefined);
expect(api.beforeRemove).toHaveBeenLastCalledWith(data);
api.remove(config);
expect(api.getUrl).toHaveBeenLastCalledWith(config, '');
expect(api.request).toHaveBeenLastCalledWith(config, undefined);
expect(api.beforeRemove).toHaveBeenLastCalledWith(config);
});
});
});
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