updates on the builded changes
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import axios from 'axios';
|
||||
import dayjs from 'dayjs';
|
||||
import { OpenToast } from 'components/nearle_components/OpenToast';
|
||||
const tenid = localStorage.getItem('tenantid');
|
||||
|
||||
|
||||
@@ -438,3 +438,23 @@ describe('orders.js empty-batch guard contract', () => {
|
||||
expect(guardFires(normaliseAssignResponse(zoned))).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
// ==========================================================================
|
||||
// Regression: cancelMultipleOrder referenced dayjs without importing it,
|
||||
// throwing a ReferenceError on the multi-cancel confirm button.
|
||||
// ==========================================================================
|
||||
describe('cancelMultipleOrder', () => {
|
||||
it('builds a cancelled timestamp without throwing a ReferenceError', async () => {
|
||||
const { cancelMultipleOrder } = require('./api');
|
||||
axios.put.mockResolvedValue({ data: { status: true } });
|
||||
await cancelMultipleOrder([{ orderheaderid: 1 }, { orderheaderid: 2 }]);
|
||||
|
||||
const [, body] = axios.put.mock.calls[0];
|
||||
expect(body).toHaveLength(2);
|
||||
body.forEach((row) => {
|
||||
expect(row.orderstatus).toBe('cancelled');
|
||||
// Real formatted timestamp, not "Invalid Date" or undefined.
|
||||
expect(row.cancelled).toMatch(/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user