Fix paste ownership, input bounds, and IPC validation
Supersedes #5745, #5746, and #5747.
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||
import { getGitCloneFailureMessage } from './git-clone-failure-message'
|
||||
|
||||
afterEach(() => {
|
||||
vi.restoreAllMocks()
|
||||
})
|
||||
|
||||
describe('getGitCloneFailureMessage', () => {
|
||||
it('turns an existing destination into an actionable message after progress output', () => {
|
||||
expect(
|
||||
@@ -41,4 +45,18 @@ describe('getGitCloneFailureMessage', () => {
|
||||
'network vanished'
|
||||
)
|
||||
})
|
||||
|
||||
it('summarizes CRLF-heavy stderr without line-array splitting', () => {
|
||||
const splitSpy = vi.spyOn(String.prototype, 'split')
|
||||
const stderr = `${'remote: counting objects\r\n'.repeat(10_000)}fatal: repository not found\r\n`
|
||||
|
||||
expect(getGitCloneFailureMessage(stderr)).toBe('fatal: repository not found')
|
||||
|
||||
const usedLineSplit = splitSpy.mock.calls.some(
|
||||
([separator]) =>
|
||||
(typeof separator === 'string' && separator === '\n') ||
|
||||
(separator instanceof RegExp && separator.source === '\\r?\\n')
|
||||
)
|
||||
expect(usedLineSplit).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user