flow-chev-edges.spec.js going through

This commit is contained in:
Knut Sveidqvist
2025-06-13 09:12:30 +02:00
parent 4a5e1a3250
commit 2b0e0ac8fa
4 changed files with 72 additions and 11 deletions

21
test-lexer.mjs Normal file
View File

@@ -0,0 +1,21 @@
// Test the actual lexer to see what tokens are generated
import { FlowchartLexer } from './packages/mermaid/src/diagrams/flowchart/parser/flowLexer.ts';
const testInputs = ['A', 'A-->B', 'graph TD;A-->B;', '-->', 'A-', '>B'];
console.log('Testing actual lexer:');
testInputs.forEach((input) => {
console.log(`\nInput: "${input}"`);
try {
const result = FlowchartLexer.tokenize(input);
if (result.errors.length > 0) {
console.log('Errors:', result.errors);
}
console.log(
'Tokens:',
result.tokens.map((t) => [t.image, t.tokenType.name])
);
} catch (error) {
console.log('Error:', error.message);
}
});