feat(prestashop): sync mapped statuses from Orbito in 1.1.11

This commit is contained in:
fatequod
2026-09-21 15:01:30 +02:00
parent af0dceaa1b
commit 11f1c99e2b
16 changed files with 587 additions and 32 deletions
+24
View File
@@ -0,0 +1,24 @@
const test = require('node:test');
const assert = require('node:assert/strict');
const { resolvePsStateId } = require('../src/status-mapper');
const STATUS_A = '507f191e810c19729de860ea';
const STATUS_B = '507f191e810c19729de860eb';
test('resolves a saved mapping in the outbound Orbito to PrestaShop direction', () => {
assert.equal(resolvePsStateId(STATUS_B, [
{ psStateId: 2, orbitoStatusId: STATUS_A },
{ psStateId: 7, orbitoStatusId: STATUS_B },
]), 7);
assert.equal(resolvePsStateId('507f191e810c19729de860ec', [
{ psStateId: 7, orbitoStatusId: STATUS_B },
]), null);
});
test('rejects an ambiguous outbound status mapping', () => {
assert.throws(() => resolvePsStateId(STATUS_A, [
{ psStateId: 2, orbitoStatusId: STATUS_A },
{ psStateId: 3, orbitoStatusId: STATUS_A },
]), /kilku statusów PrestaShop/);
});