@capillarytech/creatives-library 9.0.53-alpha.1 → 9.0.53-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -444,6 +444,28 @@ describe('handleSave — CCS flow', () => {
|
|
|
444
444
|
);
|
|
445
445
|
});
|
|
446
446
|
|
|
447
|
+
it('preserves a real version of 0 from CCS (not coerced to 1 by a falsy-zero fallback)', async () => {
|
|
448
|
+
const onSave = jest.fn();
|
|
449
|
+
createCommDefinition.mockResolvedValueOnce({
|
|
450
|
+
response: { data: { id: 'cd_123', referenceId: 'ORDER_PLACED_123', status: 'DRAFT', version: { version: 0 } } },
|
|
451
|
+
});
|
|
452
|
+
renderWithFlow({
|
|
453
|
+
features: {},
|
|
454
|
+
config: ccsConfig,
|
|
455
|
+
initialData: { contentItems: [{ channel: 'SMS', templateData: {} }] },
|
|
456
|
+
onSave,
|
|
457
|
+
});
|
|
458
|
+
|
|
459
|
+
await userEvent.click(screen.getByRole('button', { name: /^save$/i }));
|
|
460
|
+
|
|
461
|
+
await waitFor(() => expect(onSave).toHaveBeenCalledTimes(1));
|
|
462
|
+
expect(onSave).toHaveBeenCalledWith(
|
|
463
|
+
expect.objectContaining({
|
|
464
|
+
ccsCommDefinition: { id: 'cd_123', referenceId: 'ORDER_PLACED_123', version: 0, status: 'DRAFT' },
|
|
465
|
+
}),
|
|
466
|
+
);
|
|
467
|
+
});
|
|
468
|
+
|
|
447
469
|
it('generates a referenceId from name when config.context.referenceId is absent', async () => {
|
|
448
470
|
// moduleMocks.js spies on Date.now globally, but this config's resetMocks:true
|
|
449
471
|
// clears that return value before every test — set it explicitly here.
|