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

@fye/aec-client

Package Overview
Dependencies
Maintainers
4
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fye/aec-client - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

44

__tests__/aec-integration.test.js

@@ -192,1 +192,45 @@ const test = require('ava');

});
test('createShipOrderRequest handles 400 series skus', t => {
const { po, availabiltyResponse } = t.context;
const testPo = {
...po,
items: [
{
...po.items[0],
productId: 'fye.000000400397336391',
sku: '000000400397336391',
},
],
};
const testAvailabilityResponse = {
...availabiltyResponse,
ID: '400397336391',
};
t.notThrows(() => AecClient.createShipOrderRequest(testPo, [testAvailabilityResponse]));
});
test('createShipOrderRequest throws matching error when no matching FYE to AEC availability is found', t => {
const { po, availabiltyResponse } = t.context;
const testPo = {
...po,
items: [
{
...po.items[0],
productId: 'fye.000000400397336391',
sku: '000000400397336391',
},
],
};
const testAvailabilityResponse = {
...availabiltyResponse,
ID: '400397336392',
};
t.throws(() =>
AecClient.createShipOrderRequest(
testPo,
[testAvailabilityResponse],
'Could not match FYE items to AEC Availibility result',
),
);
});

9

aec.js

@@ -91,5 +91,10 @@ const got = require('got');

return items.map(item => {
const { QtyAdj, QtyBO, Qty } = availabilityResult.find(result => result.ID === item.sku);
const id = item.productId.includes('fye.') ? `${Number(item.sku)}` : item.sku;
const availability = availabilityResult.find(result => result.ID === id);
if (!availability) {
throw new Error('Could not match FYE items to AEC Availibility result');
}
const { QtyAdj, QtyBO, Qty } = availability;
return {
ID: item.sku,
ID: id,
Status: QtyBO || QtyAdj ? 0 : undefined,

@@ -96,0 +101,0 @@ QtyAdj,

{
"name": "@fye/aec-client",
"version": "1.0.0",
"version": "1.0.1",
"main": "aec.js",

@@ -5,0 +5,0 @@ "author": "Brian Kurtz <bkurtz@fye.com>",

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