kimi-code/packages/agent-core-v2/test/plugin/source.test.ts
haozhe.yang 5fece98c91 refactor(agent-core-v2): group src domains by lifecycle scope
Move src/{domain}/* to src/{scope}/{domain}/* (app/session/agent) so the
directory layout mirrors the DI LifecycleScope tree. Split the three
multi-scope domains so no domain spans two scopes:

- log      -> app/log + session/sessionLog
- question -> session/question + agent/questionTools
- skill    -> app/globalSkillCatalog + session/sessionSkillCatalog + agent/skill

Rewrite every #/ and relative import, module augmentation, vi.mock, and
source-path read; update the package barrel, registerScopedService domain
labels, the domain-layer checker, the dep-graph script, file headers, and
the di-scope-domains map.
2026-07-01 15:11:49 +08:00

41 lines
1.3 KiB
TypeScript

import { describe, expect, it } from 'vitest';
import { resolveInstallSource } from '#/app/plugin/source';
describe('resolveInstallSource', () => {
it('resolves absolute local paths', () => {
expect(resolveInstallSource('/tmp/plugin')).toEqual({ kind: 'local-path', path: '/tmp/plugin' });
});
it('resolves zip urls', () => {
expect(resolveInstallSource('https://example.com/plugin.zip')).toEqual({
kind: 'zip-url',
path: 'https://example.com/plugin.zip',
});
});
it('resolves github tree, release tag, and commit urls', () => {
expect(resolveInstallSource('https://github.com/owner/repo/tree/release%231')).toEqual({
kind: 'github',
owner: 'owner',
repo: 'repo',
ref: { kind: 'branch', value: 'release#1' },
});
expect(resolveInstallSource('https://github.com/owner/repo/releases/tag/v1.2.3')).toEqual({
kind: 'github',
owner: 'owner',
repo: 'repo',
ref: { kind: 'tag', value: 'v1.2.3' },
});
expect(resolveInstallSource('https://github.com/owner/repo/commit/abc1234')).toEqual({
kind: 'github',
owner: 'owner',
repo: 'repo',
ref: { kind: 'sha', value: 'abc1234' },
});
});
it('rejects relative paths', () => {
expect(() => resolveInstallSource('./plugin')).toThrow('absolute path');
});
});