fix: normalize campaign product size suffixes
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 2m44s
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 2m44s
This commit is contained in:
23
backend/test/stockMapper.test.js
Normal file
23
backend/test/stockMapper.test.js
Normal file
@@ -0,0 +1,23 @@
|
||||
const assert = require('node:assert/strict');
|
||||
const test = require('node:test');
|
||||
|
||||
const { getBaseProductName } = require('../mappers/stockMapper');
|
||||
|
||||
test('getBaseProductName strips TAMANHO suffixes', () => {
|
||||
assert.equal(
|
||||
getBaseProductName('BASE LISA CAMISETA COR BRANCO TAMANHO - P'),
|
||||
'BASE LISA CAMISETA COR BRANCO'
|
||||
);
|
||||
});
|
||||
|
||||
test('getBaseProductName strips trailing size suffixes without removing colors', () => {
|
||||
assert.equal(
|
||||
getBaseProductName('BASE LISA MOLETOM CANGURU COR PRETO - M'),
|
||||
'BASE LISA MOLETOM CANGURU COR PRETO'
|
||||
);
|
||||
assert.equal(
|
||||
getBaseProductName('BASE LISA MOLETOM CANGURU COR PRETO - M/G/GG'),
|
||||
'BASE LISA MOLETOM CANGURU COR PRETO'
|
||||
);
|
||||
assert.equal(getBaseProductName('BONÉ - BRANCO'), 'BONÉ - BRANCO');
|
||||
});
|
||||
Reference in New Issue
Block a user