feat: get the operator type from id #918 (#1323)

### 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:
balibabu
2024-07-01 10:27:32 +08:00
committed by GitHub
parent fc7cc1d36c
commit 4542346f18
6 changed files with 521 additions and 15 deletions

View File

@@ -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);
});