### What problem does this PR solve? feat: build nodes and edges from customer_service dsl #918 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import customer_service from '../../../../graph/test/dsl_examples/customer_service.json';
|
||||
import headhunter_zh from '../../../../graph/test/dsl_examples/headhunter_zh.json';
|
||||
import { dsl } from './mock';
|
||||
import { buildNodesAndEdgesFromDSLComponents } from './utils';
|
||||
@@ -32,7 +33,7 @@ test('buildNodesAndEdgesFromDSLComponents', () => {
|
||||
);
|
||||
});
|
||||
|
||||
test('build nodes and edges from dsl', () => {
|
||||
test('build nodes and edges from headhunter_zh dsl', () => {
|
||||
const { edges, nodes } = buildNodesAndEdgesFromDSLComponents(
|
||||
headhunter_zh.components,
|
||||
);
|
||||
@@ -49,3 +50,21 @@ test('build nodes and edges from dsl', () => {
|
||||
}
|
||||
expect(nodes.length).toEqual(12);
|
||||
});
|
||||
|
||||
test('build nodes and edges from customer_service dsl', () => {
|
||||
const { edges, nodes } = buildNodesAndEdgesFromDSLComponents(
|
||||
customer_service.components,
|
||||
);
|
||||
console.info('node length', nodes.length);
|
||||
console.info('edge length', edges.length);
|
||||
try {
|
||||
fs.writeFileSync(
|
||||
path.join(__dirname, 'customer_service.json'),
|
||||
JSON.stringify({ edges, nodes }, null, 4),
|
||||
);
|
||||
console.log('JSON data is saved.');
|
||||
} catch (error) {
|
||||
console.warn(error);
|
||||
}
|
||||
expect(nodes.length).toEqual(12);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user