### What problem does this PR solve? feat: get the operator type from id #918 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import headhunter_zh from '../../../../graph/test/dsl_examples/headhunter_zh.json';
|
||||
import { dsl } from './mock';
|
||||
import { buildNodesAndEdgesFromDSLComponents } from './utils';
|
||||
|
||||
@@ -28,3 +31,19 @@ test('buildNodesAndEdgesFromDSLComponents', () => {
|
||||
]),
|
||||
);
|
||||
});
|
||||
|
||||
test('build nodes and edges from dsl', () => {
|
||||
const { edges, nodes } = buildNodesAndEdgesFromDSLComponents(
|
||||
headhunter_zh.components,
|
||||
);
|
||||
try {
|
||||
fs.writeFileSync(
|
||||
path.join(__dirname, 'headhunter_zh.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