refactor: isolate operation ranges and intents
This commit is contained in:
@@ -1,4 +1,30 @@
|
||||
import { operationIntervals, planOperationRead } from './operations-sync-plan';
|
||||
import { confirmedOperationRanges, operationIntervals, planOperationRead } from './operations-sync-plan';
|
||||
|
||||
describe('confirmed operation range projection', () => {
|
||||
it('clips overlaps in source order without merging and respects account and instrument scope', () => {
|
||||
const day = (value: number) => new Date(Date.UTC(2026, 0, value));
|
||||
const target = { accountId: 'a', from: day(2), to: day(5) };
|
||||
const sources = [
|
||||
{ ...target, from: day(3), to: day(6) },
|
||||
{ ...target, from: day(1), to: day(4) },
|
||||
{ ...target, instrumentUid: 'uid' },
|
||||
{ ...target, accountId: 'other' },
|
||||
{ ...target, from: day(5), to: day(6) },
|
||||
{ ...target, from: day(1), to: day(2) },
|
||||
];
|
||||
const before = structuredClone(sources);
|
||||
expect(confirmedOperationRanges([target], sources)).toEqual([
|
||||
{ ...target, from: day(3) },
|
||||
{ ...target, to: day(4) },
|
||||
]);
|
||||
expect(confirmedOperationRanges([{ ...target, instrumentUid: 'uid' }], sources)).toEqual([
|
||||
{ ...target, from: day(3) },
|
||||
{ ...target, to: day(4) },
|
||||
target,
|
||||
]);
|
||||
expect(sources).toEqual(before);
|
||||
});
|
||||
});
|
||||
|
||||
describe('operations calendar windows', () => {
|
||||
it('merges overlaps before splitting leap February and keeps precise Moscow-derived boundaries', () => {
|
||||
|
||||
Reference in New Issue
Block a user