Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||
import {
|
||||
buildPullRequestFieldsPrompt,
|
||||
GENERATED_PULL_REQUEST_JSON_STRUCTURE_LIMITS,
|
||||
parseGeneratedPullRequestFields,
|
||||
type PullRequestDraftContext
|
||||
} from './pull-request-generation'
|
||||
@@ -94,17 +93,4 @@ describe('parseGeneratedPullRequestFields', () => {
|
||||
draft: false
|
||||
})
|
||||
})
|
||||
|
||||
it('rejects excessive nesting before JSON.parse', () => {
|
||||
const parseSpy = vi.spyOn(JSON, 'parse')
|
||||
const depth = GENERATED_PULL_REQUEST_JSON_STRUCTURE_LIMITS.nestingDepth + 1
|
||||
try {
|
||||
expect(() =>
|
||||
parseGeneratedPullRequestFields(`${'['.repeat(depth)}0${']'.repeat(depth)}`, context)
|
||||
).toThrow(/JSON nesting exceeds/)
|
||||
expect(parseSpy).not.toHaveBeenCalled()
|
||||
} finally {
|
||||
parseSpy.mockRestore()
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user