Skip to content

Commit

Permalink
fix(deps): fix tests and stubbing
Browse files Browse the repository at this point in the history
  • Loading branch information
mgagliardo91 committed Dec 10, 2024
1 parent 102c659 commit 4ca7704
Show file tree
Hide file tree
Showing 42 changed files with 507 additions and 143 deletions.
355 changes: 355 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"description": "",
"main": "lib/index.js",
"module": "esm/index.js",
"type": "commonjs",
"publishConfig": {
"access": "public"
},
Expand Down Expand Up @@ -53,6 +54,7 @@
"auth0-js": "^9.14.2",
"axios": "^1.6.8",
"change-case": "^4.1.2",
"core-js": "^3.39.0",
"lodash.has": "^4.5.2",
"lodash.isplainobject": "^4.0.6",
"lodash.once": "^4.1.1",
Expand All @@ -66,6 +68,7 @@
"@babel/core": "^7.26.0",
"@babel/eslint-parser": "^7.25.9",
"@babel/preset-env": "^7.26.0",
"@babel/register": "^7.25.9",
"@eslint/compat": "^1.2.2",
"babel-plugin-istanbul": "^7.0.0",
"chai": "^4.1.2",
Expand Down
12 changes: 6 additions & 6 deletions src/bus/channels.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import isPlainObject from 'lodash.isplainobject';
import { toCamelCase, toSnakeCase } from '../utils/objects';
import ObjectUtils from '../utils/objects';

/**
* @typedef {Object} MessageBusChannel
Expand Down Expand Up @@ -71,9 +71,9 @@ class Channels {
`${this._baseUrl}/organizations/${channel.organizationId}/services/${
channel.serviceId
}/channels`,
toSnakeCase(channel)
ObjectUtils.toSnakeCase(channel)
)
.then((response) => toCamelCase(response));
.then((response) => ObjectUtils.toCamelCase(response));
}

/**
Expand Down Expand Up @@ -166,7 +166,7 @@ class Channels {
this._baseUrl
}/organizations/${organizationId}/services/${serviceId}/channels/${channelId}`
)
.then((response) => toCamelCase(response));
.then((response) => ObjectUtils.toCamelCase(response));
}

/**
Expand Down Expand Up @@ -228,7 +228,7 @@ class Channels {
`${
this._baseUrl
}/organizations/${organizationId}/services/${serviceId}/channels/${channelId}`,
toSnakeCase(update)
ObjectUtils.toSnakeCase(update)
);
}

Expand Down Expand Up @@ -283,7 +283,7 @@ class Channels {
}/organizations/${organizationId}/services/${serviceId}/channels/${channelId}/peek/${subscription}`,
{ params: { messagePos } }
)
.then((response) => toCamelCase(response));
.then((response) => ObjectUtils.toCamelCase(response));
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/bus/channels.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import omit from 'lodash.omit';
import Channels from './channels';
import * as objectUtils from '../utils/objects';
import objectUtils from '../utils/objects';

describe('Bus/Channels', function() {
let baseRequest;
Expand Down
14 changes: 7 additions & 7 deletions src/coordinator/applications.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { toCamelCase } from '../utils/objects';
import ObjectUtils from '../utils/objects';

/**
* @typedef {Object} ContxtApplication
Expand Down Expand Up @@ -107,7 +107,7 @@ class Applications {

return this._request
.post(`${this._baseUrl}/applications/${applicationId}/favorites`)
.then((favoriteApplication) => toCamelCase(favoriteApplication));
.then((favoriteApplication) => ObjectUtils.toCamelCase(favoriteApplication));
}

/**
Expand All @@ -129,7 +129,7 @@ class Applications {
getAll() {
return this._request
.get(`${this._baseUrl}/applications`)
.then((apps) => apps.map((app) => toCamelCase(app)));
.then((apps) => apps.map((app) => ObjectUtils.toCamelCase(app)));
}

/**
Expand All @@ -153,7 +153,7 @@ class Applications {
getFavorites() {
return this._request
.get(`${this._baseUrl}/applications/favorites`)
.then((favoriteApps) => toCamelCase(favoriteApps));
.then((favoriteApps) => ObjectUtils.toCamelCase(favoriteApps));
}

/**
Expand Down Expand Up @@ -181,7 +181,7 @@ class Applications {
if (this._organizationId) {
return this._request
.get(`${this._baseUrl}/applications/featured`)
.then((featuredApplications) => toCamelCase(featuredApplications));
.then((featuredApplications) => ObjectUtils.toCamelCase(featuredApplications));
}

if (!organizationId) {
Expand All @@ -196,7 +196,7 @@ class Applications {
.get(
`${this._baseUrl}/organizations/${organizationId}/applications/featured`
)
.then((featuredApplications) => toCamelCase(featuredApplications));
.then((featuredApplications) => ObjectUtils.toCamelCase(featuredApplications));
}

/**
Expand All @@ -221,7 +221,7 @@ class Applications {
getGroupings(applicationId) {
return this._request
.get(`${this._baseUrl}/applications/${applicationId}/groupings`)
.then((groupings) => toCamelCase(groupings));
.then((groupings) => ObjectUtils.toCamelCase(groupings));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/coordinator/applications.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as objectUtils from '../utils/objects';
import objectUtils from '../utils/objects';
import Applications from './applications';

describe('Coordinator/Applications', function() {
Expand Down
6 changes: 3 additions & 3 deletions src/coordinator/consent.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { toCamelCase } from '../utils/objects';
import ObjectUtils from '../utils/objects';

/**
* @typedef {Object} ContxtApplicationConsent
Expand Down Expand Up @@ -102,7 +102,7 @@ class Consent {
.post(`${this._baseUrl}/consents/${consentId}/accept`, {
access_token: accessToken
})
.then((userApproval) => toCamelCase(userApproval));
.then((userApproval) => ObjectUtils.toCamelCase(userApproval));
});
}

Expand Down Expand Up @@ -136,7 +136,7 @@ class Consent {
.post(`${this._baseUrl}/applications/consent`, {
access_token: accessToken
})
.then((applicationConsent) => toCamelCase(applicationConsent));
.then((applicationConsent) => ObjectUtils.toCamelCase(applicationConsent));
});
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/coordinator/edgeNodes.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { toCamelCase } from '../utils/objects';
import ObjectUtils from '../utils/objects';

/**
* @typedef {Object} EdgeNode
Expand Down Expand Up @@ -60,7 +60,7 @@ class EdgeNodes {

return this._request
.get(`${this._baseUrl}/edgenodes/${edgeNodeClientId}`)
.then((edgeNode) => toCamelCase(edgeNode));
.then((edgeNode) => ObjectUtils.toCamelCase(edgeNode));
}

if (!organizationId) {
Expand All @@ -81,7 +81,7 @@ class EdgeNodes {
this._baseUrl
}/organizations/${organizationId}/edgenodes/${edgeNodeClientId}`
)
.then((edgeNode) => toCamelCase(edgeNode));
.then((edgeNode) => ObjectUtils.toCamelCase(edgeNode));
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/coordinator/edgeNodes.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as objectUtils from '../utils/objects';
import objectUtils from '../utils/objects';
import EdgeNodes from './edgeNodes';

describe('edgeNodes', function() {
Expand Down
8 changes: 4 additions & 4 deletions src/coordinator/organizations.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { toCamelCase } from '../utils/objects';
import ObjectUtils from '../utils/objects';

/**
* @typedef {Object} ContxtOrganization
Expand Down Expand Up @@ -51,7 +51,7 @@ class Organizations {
if (this._organizationId) {
return this._request
.get(`${this._baseUrl}/${this._organizationId}`)
.then((org) => toCamelCase(org));
.then((org) => ObjectUtils.toCamelCase(org));
}

if (!organizationId) {
Expand All @@ -64,7 +64,7 @@ class Organizations {

return this._request
.get(`${this._baseUrl}/organizations/${organizationId}`)
.then((org) => toCamelCase(org));
.then((org) => ObjectUtils.toCamelCase(org));
}

/**
Expand All @@ -86,7 +86,7 @@ class Organizations {
getAll() {
return this._request
.get(`${this._baseUrl}/organizations`)
.then((orgs) => orgs.map((org) => toCamelCase(org)));
.then((orgs) => orgs.map((org) => ObjectUtils.toCamelCase(org)));
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/coordinator/organizations.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as objectUtils from '../utils/objects';
import objectUtils from '../utils/objects';
import Organizations from './organizations';

describe('Coordinator/Organizations', function() {
Expand Down
12 changes: 6 additions & 6 deletions src/coordinator/permissions.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { toCamelCase } from '../utils/objects';
import ObjectUtils from '../utils/objects';

/**
* @typedef {Object} ContxtUserPermissions
Expand Down Expand Up @@ -52,7 +52,7 @@ class Permissions {
if (this._organizationId) {
return this._request
.get(`${this._baseUrl}/users/permissions`)
.then((userPermissions) => toCamelCase(userPermissions));
.then((userPermissions) => ObjectUtils.toCamelCase(userPermissions));
}

if (!organizationId) {
Expand All @@ -65,7 +65,7 @@ class Permissions {

return this._request
.get(`${this._baseUrl}/organizations/${organizationId}/users/permissions`)
.then((userPermissions) => toCamelCase(userPermissions));
.then((userPermissions) => ObjectUtils.toCamelCase(userPermissions));
}

/**
Expand Down Expand Up @@ -100,7 +100,7 @@ class Permissions {

return this._request
.get(`${this._baseUrl}/users/${userId}/permissions`)
.then((userPermissions) => toCamelCase(userPermissions));
.then((userPermissions) => ObjectUtils.toCamelCase(userPermissions));
}

if (!organizationId) {
Expand All @@ -125,7 +125,7 @@ class Permissions {
this._baseUrl
}/organizations/${organizationId}/users/${userId}/permissions`
)
.then((userPermissions) => toCamelCase(userPermissions));
.then((userPermissions) => ObjectUtils.toCamelCase(userPermissions));
}

/**
Expand Down Expand Up @@ -158,7 +158,7 @@ class Permissions {
);
}

// NOTE: This response is not run through the `toCamelCase` method because
// NOTE: This response is not run through the `ObjectUtils.toCamelCase` method because
// it could errantly remove underscores from service IDs.
return this._request.get(`${this._baseUrl}/users/${userId}/permissions`);
}
Expand Down
2 changes: 1 addition & 1 deletion src/coordinator/permissions.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as objectUtils from '../utils/objects';
import objectUtils from '../utils/objects';
import Permissions from './permissions';

describe('Coordinator/Permissions', function() {
Expand Down
18 changes: 9 additions & 9 deletions src/coordinator/roles.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { toSnakeCase, toCamelCase } from '../utils/objects';
import ObjectUtils from '../utils/objects';

/**
* @typedef {Object} ContxtRole
Expand Down Expand Up @@ -98,7 +98,7 @@ class Roles {

return this._request
.post(`${this._baseUrl}/roles/${roleId}/applications/${applicationId}`)
.then((response) => toCamelCase(response));
.then((response) => ObjectUtils.toCamelCase(response));
}

/**
Expand Down Expand Up @@ -155,7 +155,7 @@ class Roles {
access_type: accessType
}
)
.then((response) => toCamelCase(response));
.then((response) => ObjectUtils.toCamelCase(response));
}

/**
Expand Down Expand Up @@ -194,8 +194,8 @@ class Roles {
}

return this._request
.post(`${this._baseUrl}/roles`, toSnakeCase(role))
.then((response) => toCamelCase(response));
.post(`${this._baseUrl}/roles`, ObjectUtils.toSnakeCase(role))
.then((response) => ObjectUtils.toCamelCase(response));
}

if (!organizationId) {
Expand All @@ -221,9 +221,9 @@ class Roles {
return this._request
.post(
`${this._baseUrl}/organizations/${organizationId}/roles`,
toSnakeCase(role)
ObjectUtils.toSnakeCase(role)
)
.then((response) => toCamelCase(response));
.then((response) => ObjectUtils.toCamelCase(response));
}

/**
Expand Down Expand Up @@ -294,7 +294,7 @@ class Roles {
if (this._organizationId) {
return this._request
.get(`${this._baseUrl}/roles`)
.then((roles) => toCamelCase(roles));
.then((roles) => ObjectUtils.toCamelCase(roles));
}

if (!organizationId) {
Expand All @@ -307,7 +307,7 @@ class Roles {

return this._request
.get(`${this._baseUrl}/organizations/${organizationId}/roles`)
.then((roles) => toCamelCase(roles));
.then((roles) => ObjectUtils.toCamelCase(roles));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/coordinator/roles.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as objectUtils from '../utils/objects';
import objectUtils from '../utils/objects';
import Roles from './roles';

describe('Coordinator/Roles', function() {
Expand Down
Loading

0 comments on commit 4ca7704

Please sign in to comment.