-
Notifications
You must be signed in to change notification settings - Fork 9
feat: add flexible deployment modes for different environments #44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,106 @@ | ||
| import { describe, it, expect } from 'bun:test'; | ||
| import { | ||
| knowledgePlugin, | ||
| knowledgePluginCore, | ||
| knowledgePluginHeadless, | ||
| createKnowledgePlugin, | ||
| KnowledgeService, | ||
| knowledgeProvider, | ||
| type KnowledgePluginConfig, | ||
| } from '../src/index'; | ||
|
|
||
| describe('Knowledge Plugin Exports', () => { | ||
| it('should export the default full plugin', () => { | ||
| expect(knowledgePlugin).toBeDefined(); | ||
| expect(knowledgePlugin.name).toBe('knowledge'); | ||
| expect(knowledgePlugin.services).toBeDefined(); | ||
| expect(knowledgePlugin.providers).toBeDefined(); | ||
| expect(knowledgePlugin.routes).toBeDefined(); | ||
| expect(knowledgePlugin.actions).toBeDefined(); | ||
| expect(knowledgePlugin.tests).toBeDefined(); | ||
| }); | ||
|
|
||
| it('should export the core plugin (service + provider only)', () => { | ||
| expect(knowledgePluginCore).toBeDefined(); | ||
| expect(knowledgePluginCore.name).toBe('knowledge'); | ||
| expect(knowledgePluginCore.services).toBeDefined(); | ||
| expect(knowledgePluginCore.providers).toBeDefined(); | ||
| expect(knowledgePluginCore.routes).toBeUndefined(); | ||
| expect(knowledgePluginCore.actions).toBeUndefined(); | ||
| expect(knowledgePluginCore.tests).toBeUndefined(); | ||
| }); | ||
|
|
||
| it('should export the headless plugin (service + provider + actions)', () => { | ||
| expect(knowledgePluginHeadless).toBeDefined(); | ||
| expect(knowledgePluginHeadless.name).toBe('knowledge'); | ||
| expect(knowledgePluginHeadless.services).toBeDefined(); | ||
| expect(knowledgePluginHeadless.providers).toBeDefined(); | ||
| expect(knowledgePluginHeadless.actions).toBeDefined(); | ||
| expect(knowledgePluginHeadless.routes).toBeUndefined(); | ||
| expect(knowledgePluginHeadless.tests).toBeUndefined(); | ||
| }); | ||
|
|
||
| it('should export the createKnowledgePlugin factory function', () => { | ||
| expect(createKnowledgePlugin).toBeDefined(); | ||
| expect(typeof createKnowledgePlugin).toBe('function'); | ||
| }); | ||
|
|
||
| it('should create a custom plugin with specific configuration', () => { | ||
| const customPlugin = createKnowledgePlugin({ | ||
| enableUI: false, | ||
| enableRoutes: false, | ||
| enableActions: true, | ||
| enableTests: false, | ||
| }); | ||
|
|
||
| expect(customPlugin).toBeDefined(); | ||
| expect(customPlugin.name).toBe('knowledge'); | ||
| expect(customPlugin.services).toBeDefined(); | ||
| expect(customPlugin.providers).toBeDefined(); | ||
| expect(customPlugin.actions).toBeDefined(); | ||
| expect(customPlugin.routes).toBeUndefined(); | ||
| expect(customPlugin.tests).toBeUndefined(); | ||
| }); | ||
|
|
||
| it('should export KnowledgeService class', () => { | ||
| expect(KnowledgeService).toBeDefined(); | ||
| expect(KnowledgeService.serviceType).toBe('knowledge'); | ||
| }); | ||
|
|
||
| it('should export knowledgeProvider', () => { | ||
| expect(knowledgeProvider).toBeDefined(); | ||
| expect(knowledgeProvider.name).toBe('KNOWLEDGE'); | ||
| }); | ||
|
|
||
| it('should create plugin with all features enabled by default', () => { | ||
| const defaultPlugin = createKnowledgePlugin(); | ||
|
|
||
| expect(defaultPlugin.services).toBeDefined(); | ||
| expect(defaultPlugin.providers).toBeDefined(); | ||
| expect(defaultPlugin.routes).toBeDefined(); | ||
| expect(defaultPlugin.actions).toBeDefined(); | ||
| expect(defaultPlugin.tests).toBeDefined(); | ||
| }); | ||
|
|
||
| it('should create plugin with only UI disabled', () => { | ||
| const noUIPlugin = createKnowledgePlugin({ | ||
| enableUI: false, | ||
| enableRoutes: true, | ||
| enableActions: true, | ||
| enableTests: true, | ||
| }); | ||
|
|
||
| expect(noUIPlugin.routes).toBeDefined(); // Routes still enabled | ||
| expect(noUIPlugin.actions).toBeDefined(); | ||
| expect(noUIPlugin.tests).toBeDefined(); | ||
| }); | ||
|
|
||
| it('should create plugin with no routes when both UI and routes disabled', () => { | ||
| const noRoutesPlugin = createKnowledgePlugin({ | ||
| enableUI: false, | ||
| enableRoutes: false, | ||
| }); | ||
|
|
||
| expect(noRoutesPlugin.routes).toBeUndefined(); | ||
| }); | ||
| }); | ||
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove unused type import and add a default export parity test.
KnowledgePluginConfigtype import.knowledgePlugin.📝 Committable suggestion
🤖 Prompt for AI Agents