test: stabilize suite and add coverage heatmap (#373)
* test: stabilize suite and add coverage heatmap * ci: run full bun test suite in pr checks
This commit is contained in:
@@ -4,6 +4,7 @@ import axios from 'axios'
|
||||
const originalEnv = { ...process.env }
|
||||
|
||||
async function importFreshModule() {
|
||||
mock.restore()
|
||||
return import(`./officialRegistry.ts?ts=${Date.now()}-${Math.random()}`)
|
||||
}
|
||||
|
||||
@@ -13,11 +14,15 @@ beforeEach(() => {
|
||||
|
||||
afterEach(() => {
|
||||
process.env = { ...originalEnv }
|
||||
mock.restore()
|
||||
})
|
||||
|
||||
describe('prefetchOfficialMcpUrls', () => {
|
||||
test('does not fetch registry when using OpenAI mode', async () => {
|
||||
process.env.CLAUDE_CODE_USE_OPENAI = '1'
|
||||
mock.module('../../utils/model/providers.js', () => ({
|
||||
getAPIProvider: () => 'openai',
|
||||
}))
|
||||
const getSpy = mock(() => Promise.resolve({ data: { servers: [] } }))
|
||||
axios.get = getSpy as typeof axios.get
|
||||
|
||||
@@ -29,6 +34,9 @@ describe('prefetchOfficialMcpUrls', () => {
|
||||
|
||||
test('does not fetch registry when using Gemini mode', async () => {
|
||||
process.env.CLAUDE_CODE_USE_GEMINI = '1'
|
||||
mock.module('../../utils/model/providers.js', () => ({
|
||||
getAPIProvider: () => 'gemini',
|
||||
}))
|
||||
const getSpy = mock(() => Promise.resolve({ data: { servers: [] } }))
|
||||
axios.get = getSpy as typeof axios.get
|
||||
|
||||
@@ -43,6 +51,9 @@ describe('prefetchOfficialMcpUrls', () => {
|
||||
delete process.env.CLAUDE_CODE_USE_GEMINI
|
||||
delete process.env.CLAUDE_CODE_USE_GITHUB
|
||||
|
||||
mock.module('../../utils/model/providers.js', () => ({
|
||||
getAPIProvider: () => 'firstParty',
|
||||
}))
|
||||
const getSpy = mock(() =>
|
||||
Promise.resolve({
|
||||
data: {
|
||||
|
||||
Reference in New Issue
Block a user