Socket
Socket
Sign inDemoInstall

@reactioncommerce/api-plugin-shops

Package Overview
Dependencies
165
Maintainers
6
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.2.5 to 1.3.0

2

package.json
{
"name": "@reactioncommerce/api-plugin-shops",
"description": "Shops plugin for the Reaction API",
"version": "1.2.5",
"version": "1.3.0",
"main": "index.js",

@@ -6,0 +6,0 @@ "type": "module",

@@ -145,2 +145,6 @@ import SimpleSchema from "simpl-schema";

for (const func of context.getFunctionsOfType("mutateShopBeforeCreate")) {
await func(context, shop); // eslint-disable-line no-await-in-loop
}
ShopSchema.validate(shop);

@@ -147,0 +151,0 @@

@@ -8,5 +8,25 @@ import mockContext from "@reactioncommerce/api-utils/tests/mockContext.js";

/**
* @summary Creates a mock plugin that extends the shop schema mutates the shop before being created
* @param {Object} context - mock context
* @return {undefined}
*/
function mockPluginExtendingShop(context) {
context.simpleSchemas.Shop.extend({
externalShopProp: {
type: String,
optional: true
}
});
context.getFunctionsOfType.mockReturnValueOnce([
(_, shop) => {
shop.externalShopProp = "externalValue";
}
]);
}
test("creates shop with type primary if there is no existing shop", async () => {
mockContext.collections.Shops.findOne.mockReturnValueOnce(Promise.resolve(null));
mockContext.collections.Shops.insertOne.mockReturnValueOnce(Promise.resolve({ result: { ok: 1 } }));
mockPluginExtendingShop(mockContext);

@@ -16,3 +36,4 @@ await expect(createShop(mockContext, {

})).resolves.toEqual(expect.objectContaining({
shopType: "primary"
shopType: "primary",
externalShopProp: "externalValue"
}));

@@ -19,0 +40,0 @@ });

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc