Fix for broken test

This commit is contained in:
Knut Sveidqvist 2022-10-07 14:36:25 +02:00
parent 047e15951a
commit 646f76d343
7 changed files with 14 additions and 10 deletions

5
V10-BreakingChanges.md Normal file
View File

@ -0,0 +1,5 @@
# A collection of updates that change the behaviour
## Lazy loading and asynchronisity
- Invalid dates are rendered as syntax error instead of returning best guess or the current date

View File

@ -92,7 +92,7 @@ describe('Gantt diagram', () => {
{}
);
});
it('should render a gantt chart for issue #1060', () => {
it('should FAIL redering a gantt chart for issue #1060 with invalid date', () => {
imgSnapshotTest(
`
gantt

View File

@ -56,7 +56,7 @@
<body>
<div>Security check</div>
<pre id="diagram" class="mermaid">
classDiagram
classDiagram
direction LR
class Student {
-idCard : IdCard

View File

@ -126,7 +126,6 @@
"jsdom": "^20.0.1",
"lint-staged": "^13.0.3",
"markdown-it": "^13.0.1",
"moment": "^2.23.0",
"path-browserify": "^1.0.1",
"pnpm": "^7.13.2",
"prettier": "^2.7.1",

View File

@ -372,11 +372,11 @@ const buildLegacyDisplay = function (text) {
const parameters = text.substring(methodStart + 1, methodEnd);
const classifier = text.substring(methodEnd + 1, 1);
cssStyle = parseClassifier(classifier);
cssStyle = parseClassifier(text.substring(methodEnd + 1, methodEnd + 2));
displayText = visibility + methodName + '(' + parseGenericTypes(parameters.trim()) + ')';
if (methodEnd < memberText.length) {
if (methodEnd < text.length) {
returnType = text.substring(methodEnd + 2).trim();
if (returnType !== '') {
returnType = ' : ' + parseGenericTypes(returnType);

View File

@ -217,10 +217,12 @@ const getStartDate = function (prevTime, dateFormat, str) {
} else {
log.debug('Invalid date:' + str);
log.debug('With date format:' + dateFormat.trim());
const d = new Date(str);
if (typeof d === 'undefined' || isNaN(d.getTime())) {
throw new Error('Invalid date:' + str);
}
return d;
}
// Default date - now
return new Date();
};
/**

2
pnpm-lock.yaml generated
View File

@ -56,7 +56,6 @@ importers:
lint-staged: ^13.0.3
lodash: ^4.17.21
markdown-it: ^13.0.1
moment: ^2.23.0
moment-mini: ^2.24.0
non-layered-tidy-tree-layout: ^2.0.2
path-browserify: ^1.0.1
@ -133,7 +132,6 @@ importers:
jsdom: 20.0.1
lint-staged: 13.0.3
markdown-it: 13.0.1
moment: 2.29.4
path-browserify: 1.0.1
pnpm: 7.13.2
prettier: 2.7.1