This commit is contained in:
yiling
2026-06-02 14:57:03 +08:00
parent be29c21564
commit 35b0081e23
15 changed files with 378 additions and 74 deletions
+8 -1
View File
@@ -16,6 +16,13 @@
"@earendil-works/pi-ai": "0.75.4",
"@temporalio/activity": "^1.16.1",
"@temporalio/worker": "^1.16.1",
"@temporalio/workflow": "^1.16.1"
"@temporalio/workflow": "^1.16.1",
"@sinclair/typebox": "^0.34.49",
"ulid": "^3.0.2",
"adm-zip": "^0.5.17",
"zod": "^4.4.3"
},
"devDependencies": {
"@types/adm-zip": "^0.5.8"
}
}
+12 -12
View File
@@ -1,20 +1,16 @@
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'
import { vi } from 'vitest'
vi.mock('@shumai/core/src/s3/s3')
vi.mock('fs')
import { describe, it, expect, beforeEach, afterEach } from 'vitest'
import { prisma } from '@shumai/db'
import { setupTestDbHooks } from '@shumai/db'
import { createReadSkillTool } from './read-skill'
import { s3Service } from '@shumai/core/src/s3/s3'
import AdmZip from 'adm-zip'
import * as fs from 'fs'
vi.mock('@shumai/core/src/s3/s3')
vi.mock('fs')
vi.mock('adm-zip', () => {
return {
default: class {
extractAllTo = vi.fn()
},
}
})
describe('readSkillTool', () => {
setupTestDbHooks()
@@ -95,9 +91,13 @@ describe('readSkillTool', () => {
return ''
})
const zip = new AdmZip()
zip.addFile('SKILL.md', Buffer.from('# Extracted Content'))
const zipBuffer = zip.toBuffer()
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- mocking s3Service return
;(s3Service.getObject as any).mockResolvedValue({
buffer: Buffer.from('zipdata'),
buffer: zipBuffer,
contentType: 'application/zip',
})