Download packages/agent-core-v2/test/app/plugin/source.test.ts from SaylorTwift/kimi-code: direct link, hf CLI and curl.
- Browser
- Download file 1.34 kB
-
https://huggingface.co/SaylorTwift/kimi-code/resolve/main/packages/agent-core-v2/test/app/plugin/source.test.ts
- Command line
-
hf download hf://SaylorTwift/kimi-code/packages/agent-core-v2/test/app/plugin/source.test.ts
-
curl -L -o source.test.ts https://huggingface.co/SaylorTwift/kimi-code/resolve/main/packages/agent-core-v2/test/app/plugin/source.test.ts
1.34 kB
| 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'); | |
| }); | |
| }); | |