mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 04:44:21 +01:00
feat(sessions): show background activity for shells and child sessions
This commit is contained in:
1 parent
51e92d8cf2
commit
2e2eff05af
7 files changed
+434
-15
No files matched your search
@@ -0,0 +1,37 @@
|
||||
import { render, screen } from '@testing-library/react'
|
||||
import { beforeEach, describe, expect, it } from 'vitest'
|
||||
import { SessionStatusIndicator } from './session-status-indicator'
|
||||
import { useSessionStatus } from '@/stores/sessionStatusStore'
|
||||
|
||||
const resetStore = () => {
|
||||
useSessionStatus.setState({
|
||||
statuses: new Map(),
|
||||
statusCache: new Map(),
|
||||
statusRevisions: new Map(),
|
||||
knownSessions: new Set(),
|
||||
outcomes: new Map(),
|
||||
parents: new Map(),
|
||||
runningShells: new Map(),
|
||||
revision: 0,
|
||||
})
|
||||
}
|
||||
|
||||
describe('SessionStatusIndicator background activity', () => {
|
||||
beforeEach(() => {
|
||||
resetStore()
|
||||
})
|
||||
|
||||
it('shows the background tasks label when idle with a running shell', () => {
|
||||
useSessionStatus.getState().setShellRunning('shell-1', 'session-a', '/repo')
|
||||
|
||||
render(<SessionStatusIndicator sessionID="session-a" showLabel />)
|
||||
|
||||
expect(screen.getByLabelText('Background tasks running')).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('renders nothing when idle without background activity', () => {
|
||||
const { container } = render(<SessionStatusIndicator sessionID="session-a" showLabel />)
|
||||
|
||||
expect(container).toBeEmptyDOMElement()
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user