mirror of
https://github.com/MoonshotAI/kimi-code.git
synced 2026-07-09 17:29:12 +00:00
* feat: add plugin manager and official plugins * fix(agent-core): honor plugin capability overrides * fix: restrict plugin zip root detection * Update apps/kimi-code/src/constant/app.ts Co-authored-by: liruifengv <liruifeng1024@gmail.com> Signed-off-by: qer <wbxl2000@outlook.com> --------- Signed-off-by: qer <wbxl2000@outlook.com> Co-authored-by: liruifengv <liruifeng1024@gmail.com>
33 lines
1.2 KiB
TypeScript
33 lines
1.2 KiB
TypeScript
import { describe, expect, it } from 'vitest';
|
|
|
|
import { resolveInstallSource } from '../../src/plugin/source';
|
|
|
|
describe('resolveInstallSource', () => {
|
|
it('recognizes https:// as zip-url', () => {
|
|
const result = resolveInstallSource('https://example.com/plugin.zip');
|
|
expect(result).toEqual({ kind: 'zip-url', path: 'https://example.com/plugin.zip' });
|
|
});
|
|
|
|
it('recognizes http:// as zip-url', () => {
|
|
const result = resolveInstallSource('http://example.com/plugin.zip');
|
|
expect(result).toEqual({ kind: 'zip-url', path: 'http://example.com/plugin.zip' });
|
|
});
|
|
|
|
it('recognizes absolute path as local-path', () => {
|
|
const result = resolveInstallSource('/home/user/plugin');
|
|
expect(result).toEqual({ kind: 'local-path', path: '/home/user/plugin' });
|
|
});
|
|
|
|
it('trims whitespace from local paths', () => {
|
|
const result = resolveInstallSource(' /home/user/plugin ');
|
|
expect(result).toEqual({ kind: 'local-path', path: '/home/user/plugin' });
|
|
});
|
|
|
|
it('throws for relative local paths', () => {
|
|
expect(() => resolveInstallSource('relative/path')).toThrow(/absolute path/i);
|
|
});
|
|
|
|
it('throws for empty string', () => {
|
|
expect(() => resolveInstallSource('')).toThrow(/absolute path/i);
|
|
});
|
|
});
|