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(`./utils.ts?ts=${Date.now()}-${Math.random()}`)
|
||||
}
|
||||
|
||||
@@ -13,11 +14,15 @@ beforeEach(() => {
|
||||
|
||||
afterEach(() => {
|
||||
process.env = { ...originalEnv }
|
||||
mock.restore()
|
||||
})
|
||||
|
||||
describe('checkDomainBlocklist', () => {
|
||||
test('returns allowed without API call in OpenAI mode', async () => {
|
||||
process.env.CLAUDE_CODE_USE_OPENAI = '1'
|
||||
mock.module('../../utils/model/providers.js', () => ({
|
||||
getAPIProvider: () => 'openai',
|
||||
}))
|
||||
const getSpy = mock(() =>
|
||||
Promise.resolve({ status: 200, data: { can_fetch: true } }),
|
||||
)
|
||||
@@ -32,6 +37,9 @@ describe('checkDomainBlocklist', () => {
|
||||
|
||||
test('returns allowed without API call in Gemini mode', async () => {
|
||||
process.env.CLAUDE_CODE_USE_GEMINI = '1'
|
||||
mock.module('../../utils/model/providers.js', () => ({
|
||||
getAPIProvider: () => 'gemini',
|
||||
}))
|
||||
const getSpy = mock(() =>
|
||||
Promise.resolve({ status: 200, data: { can_fetch: true } }),
|
||||
)
|
||||
@@ -49,6 +57,9 @@ describe('checkDomainBlocklist', () => {
|
||||
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({ status: 200, data: { can_fetch: true } }),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user