refactor(skill): add null check for SkillManager and update tests

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
tanzhenxin 2026-02-06 13:37:35 +08:00
parent fcc98a30d5
commit 27a9d3ec44
3 changed files with 17 additions and 1 deletions

View file

@ -116,11 +116,20 @@ vi.mock('read-package-up', () => ({
vi.mock('@qwen-code/qwen-code-core', async (importOriginal) => {
const actualServer = await importOriginal<typeof ServerConfig>();
const SkillManagerMock = vi.fn();
SkillManagerMock.prototype.startWatching = vi
.fn()
.mockResolvedValue(undefined);
SkillManagerMock.prototype.stopWatching = vi.fn();
SkillManagerMock.prototype.listSkills = vi.fn().mockResolvedValue([]);
SkillManagerMock.prototype.addChangeListener = vi.fn();
SkillManagerMock.prototype.removeChangeListener = vi.fn();
return {
...actualServer,
NativeLspService: vi
.fn()
.mockImplementation(() => createNativeLspServiceInstance()),
SkillManager: SkillManagerMock,
IdeClient: {
getInstance: vi.fn().mockResolvedValue({
getConnectionStatus: vi.fn(),