Fix getters mutating state on repeated access

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-07 07:31:59 +08:00
parent ef8ce0d778
commit eeea16be38
4 changed files with 77 additions and 35 deletions

View File

@@ -196,5 +196,18 @@ describe('conformanceStore', () => {
// The date attribute should show minutes (30), not month (06)
expect(result[0].attributes[0].value).toMatch(/:30:/);
});
it('cases getter does not corrupt original state on repeated access', () => {
const originalDate = '2023-06-15T10:30:00Z';
store.allCases = [{
started_at: originalDate,
completed_at: '2023-06-15T11:45:00Z',
facets: [],
attributes: [],
}];
store.cases;
// Original state should still contain the ISO date
expect(store.allCases[0].started_at).toBe(originalDate);
});
});
});