mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-08-15 06:19:24 +02:00
fix: failing unit tests
on-behalf-of: @Mermaid-Chart <hello@mermaidchart.com>
This commit is contained in:
@@ -182,7 +182,7 @@ describe('Cose-Bilkent Layout Algorithm', () => {
|
|||||||
|
|
||||||
it('should throw error for invalid nodes array', () => {
|
it('should throw error for invalid nodes array', () => {
|
||||||
const invalidData = { ...mockLayoutData, nodes: null as any };
|
const invalidData = { ...mockLayoutData, nodes: null as any };
|
||||||
expect(() => validateLayoutData(invalidData)).toThrow('Nodes array is required');
|
expect(() => validateLayoutData(invalidData)).toThrow('No nodes found in layout data');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should throw error for invalid edges array', () => {
|
it('should throw error for invalid edges array', () => {
|
||||||
|
@@ -65,7 +65,7 @@ export function validateLayoutData(data: LayoutData): boolean {
|
|||||||
throw new Error('Root node is required');
|
throw new Error('Root node is required');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!data.nodes || !Array.isArray(data.nodes) || data.nodes.length === 0) {
|
if (!data.nodes || !Array.isArray(data.nodes)) {
|
||||||
throw new Error('No nodes found in layout data');
|
throw new Error('No nodes found in layout data');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user