fix: handle uncaught exceptions in Gantt chart rendering test for invalid dates

on-behalf-of: @Mermaid-Chart <hello@mermaidchart.com>
This commit is contained in:
omkarht
2025-11-26 18:59:18 +05:30
parent 8bfd47758a
commit bf50ce5237

View File

@@ -118,6 +118,15 @@ describe('Gantt diagram', () => {
);
});
it('should FAIL rendering a gantt chart for issue #1060 with invalid date', () => {
let errorCaught = false;
cy.on('uncaught:exception', (err) => {
// Expect error related to invalid or missing date format
expect(err.message).to.include('Invalid date');
errorCaught = true;
return false; // prevent Cypress from failing the test
});
imgSnapshotTest(
`
gantt
@@ -150,12 +159,16 @@ describe('Gantt diagram', () => {
section Plasma Calls & updates
OVM :ovm, 2019-07-12, 120d
Plasma call 26 :pc26, 2019-08-21, 1d
Plasma call 27 :pc27, 2019-09-03, 1d
Plasma call 28 :pc28, 2019-09-17, 1d
`,
Plasma call 26 :pc26, 2019-08-21, 1d
Plasma call 27 :pc27, 2019-09-03, 1d
Plasma call 28 :pc28, 2019-09-17, 1d
`,
{}
);
cy.then(() => {
expect(errorCaught, 'Expected rendering to fail with invalid date error').to.equal(true);
});
});
it('should default to showing today marker', () => {