forked from infiniflow/ragflow
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: test buildNodesAndEdgesFromDSLComponents (infiniflow#940)
### What problem does this PR solve? feat: test buildNodesAndEdgesFromDSLComponents infiniflow#918 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
- Loading branch information
Showing
9 changed files
with
12,340 additions
and
7,684 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import '@testing-library/jest-dom'; | ||
import 'umi/test-setup'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { Config, configUmiAlias, createConfig } from 'umi/test'; | ||
|
||
export default async () => { | ||
return (await configUmiAlias({ | ||
...createConfig({ | ||
target: 'browser', | ||
jsTransformer: 'esbuild', | ||
// config opts for esbuild , it will pass to esbuild directly | ||
jsTransformerOpts: { jsx: 'automatic' }, | ||
}), | ||
setupFilesAfterEnv: ['<rootDir>/jest-setup.ts'], | ||
collectCoverageFrom: [ | ||
'**/*.{ts,tsx,js,jsx}', | ||
'!.umi/**', | ||
'!.umi-test/**', | ||
'!.umi-production/**', | ||
'!.umirc.{js,ts}', | ||
'!.umirc.*.{js,ts}', | ||
'!jest.config.{js,ts}', | ||
'!coverage/**', | ||
'!dist/**', | ||
'!config/**', | ||
'!mock/**', | ||
], | ||
// if you require some es-module npm package, please uncomment below line and insert your package name | ||
// transformIgnorePatterns: ['node_modules/(?!.*(lodash-es|your-es-pkg-name)/)'] | ||
coverageThreshold: { | ||
global: { | ||
lines: 1, | ||
}, | ||
}, | ||
})) as Config.InitialOptions; | ||
}; |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { dsl } from './mock'; | ||
import { buildNodesAndEdgesFromDSLComponents } from './utils'; | ||
|
||
test('buildNodesAndEdgesFromDSLComponents', () => { | ||
const { edges, nodes } = buildNodesAndEdgesFromDSLComponents(dsl.components); | ||
|
||
expect(nodes.length).toEqual(4); | ||
expect(edges.length).toEqual(4); | ||
|
||
expect(edges).toEqual( | ||
expect.arrayContaining([ | ||
expect.objectContaining({ | ||
source: 'begin', | ||
target: 'Answer:China', | ||
}), | ||
expect.objectContaining({ | ||
source: 'Answer:China', | ||
target: 'Retrieval:China', | ||
}), | ||
expect.objectContaining({ | ||
source: 'Retrieval:China', | ||
target: 'Generate:China', | ||
}), | ||
expect.objectContaining({ | ||
source: 'Generate:China', | ||
target: 'Answer:China', | ||
}), | ||
]), | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"extends": "./src/.umi/tsconfig.json", | ||
"@@/*": [ | ||
"src/.umi/*" | ||
"src/.umi/*", | ||
], | ||
} |