Skip to content

Commit

Permalink
fix(iows): accept product code in dot notation (#77)
Browse files Browse the repository at this point in the history
  • Loading branch information
bartsimp authored Dec 16, 2021
1 parent fb32a40 commit b469286
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion source/lib/iows2.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ class IOWS2 {
`Expected first argument productId to be a string, instead ${typeof productId} given. (5492aeea)`
);
buCode = String(buCode).trim();
productId = String(productId).trim();
productId = String(productId).trim().replace(/\./g, '');

if (!productType) {
productType = PRODUCT_TYPE.ART;
Expand Down
11 changes: 11 additions & 0 deletions source/lib/iows2.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,17 @@ describe('IOWS2', () => {
});
});

it('accept product code in dot notation', () => {
const scope = nock(iows.baseUrl)
.get((uri) => {
expect(uri).to.match(/\/999$/);
return true;
})
.reply(200, bodyData);
return iows.getStoreProductAvailability('123', '9.9.9')
.then(() => scope.isDone());
});

it('detects the productType form the productCode when it starts with an "s"', () => {
const scope = nock(iows.baseUrl)
.get((uri) => {
Expand Down

0 comments on commit b469286

Please sign in to comment.