fix: extract path-security helpers, add tests, and improve type safety (#102)
* fix: extract path-security helpers and refactor IPC modules - Extracted path-security helpers from filesystem.ts into filesystem-auth.ts to fix max-lines lint error (402 -> 293 lines) - Extracted duplicated ENOENT detection into isENOENT() helper to eliminate code duplication - Fixed missing curly braces on single-line if-return in isDescendantOrEqual (lint violation) - Replaced any with unknown in test files to satisfy lint rules - All tests passing (29/29) - Lint clean (0 errors, 0 warnings) * fix: bundle preload deps for sandbox mode and fix editor test types The sandbox: true change in createMainWindow broke the app because electron-vite was externalizing @electron-toolkit/preload, producing a require() call that fails in sandboxed preload scripts. Exclude it from externalization so it gets bundled inline. Also fix type errors in editor.test.ts from the partial store setup. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
6aab126edb
commit
4c0eee235b
@@ -1,5 +1,17 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { deriveCheckStatus } from './client'
|
||||
import { deriveCheckStatus, mapPRState } from './client'
|
||||
|
||||
describe('mapPRState', () => {
|
||||
it('returns draft when an open PR is marked as draft', () => {
|
||||
expect(mapPRState('OPEN', true)).toBe('draft')
|
||||
})
|
||||
|
||||
it('preserves merged and closed states', () => {
|
||||
expect(mapPRState('MERGED', true)).toBe('merged')
|
||||
expect(mapPRState('CLOSED', true)).toBe('closed')
|
||||
expect(mapPRState('OPEN')).toBe('open')
|
||||
})
|
||||
})
|
||||
|
||||
describe('deriveCheckStatus', () => {
|
||||
it('returns neutral when no checks are present', () => {
|
||||
@@ -8,12 +20,7 @@ describe('deriveCheckStatus', () => {
|
||||
})
|
||||
|
||||
it('returns failure when a failed check is present', () => {
|
||||
expect(
|
||||
deriveCheckStatus([
|
||||
{ status: 'QUEUED' },
|
||||
{ conclusion: 'FAILURE' }
|
||||
])
|
||||
).toBe('failure')
|
||||
expect(deriveCheckStatus([{ status: 'QUEUED' }, { conclusion: 'FAILURE' }])).toBe('failure')
|
||||
})
|
||||
|
||||
it('returns pending when checks are still running', () => {
|
||||
@@ -21,11 +28,8 @@ describe('deriveCheckStatus', () => {
|
||||
})
|
||||
|
||||
it('returns success when all checks complete without failures', () => {
|
||||
expect(
|
||||
deriveCheckStatus([
|
||||
{ conclusion: 'SUCCESS' },
|
||||
{ conclusion: 'SKIPPED' }
|
||||
])
|
||||
).toBe('success')
|
||||
expect(deriveCheckStatus([{ conclusion: 'SUCCESS' }, { conclusion: 'SKIPPED' }])).toBe(
|
||||
'success'
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user