mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 12:24:30 +01:00
fix: apply 2 pr-agent suggestions
- frontend/src/contexts/EventContext.test.tsx:501 Make the deferred-bootstrap test assert real behavior - backend/test/services/opencode-single-server.test.ts:352 Restore process env instead of deleting HOME/SHELL Applied-by: pr-agent-autoapply
This commit is contained in:
1 parent
b625acfc0c
commit
b9ab85d44c
2 files changed
+8
-5
No files matched your search
@@ -349,18 +349,19 @@ describe('OpenCodeServerManager - child environment', () => {
|
||||
ENV: '/workspace/repos/evil/envrc',
|
||||
HOME: '/tmp/evil-user-home',
|
||||
} satisfies Record<string, string>
|
||||
const restoreEnv = applyTestEnv(
|
||||
fromPreferences ? {} : vars,
|
||||
)
|
||||
try {
|
||||
if (fromPreferences) {
|
||||
new SettingsService(context.db).updateSettings({
|
||||
serverEnvVars: Object.entries(vars).map(([key, value]) => ({ key, value })),
|
||||
})
|
||||
} else {
|
||||
for (const [key, value] of Object.entries(vars)) process.env[key] = value
|
||||
}
|
||||
|
||||
await context.harness.manager.start()
|
||||
} finally {
|
||||
for (const key of Object.keys(vars)) delete process.env[key]
|
||||
restoreEnv()
|
||||
}
|
||||
|
||||
const env = context.harness.spawnEnv()
|
||||
|
||||
@@ -499,14 +499,16 @@ afterEach(() => {
|
||||
describe('EventProvider permissions and forms', () => {
|
||||
it('defers authenticated bootstrap reads and the event stream until a session exists', async () => {
|
||||
const api = createApiState()
|
||||
renderWithProviders(<Harness />, {
|
||||
const result = renderWithProviders(<Harness />, {
|
||||
events: true,
|
||||
auth: 'anonymous',
|
||||
fetchRoutes: providerRoutes(api),
|
||||
})
|
||||
|
||||
await waitFor(() => expect(screen.getByTestId('count')).toBeInTheDocument())
|
||||
expect(api.permissions.length).toBe(0)
|
||||
expect(result.fetchFake.findRequests('GET', '/api/repos')).toHaveLength(0)
|
||||
expect(result.fetchFake.findRequests('GET', `${localApi}/permission/request`)).toHaveLength(0)
|
||||
expect(result.eventStream?.openedUrls ?? []).toHaveLength(0)
|
||||
})
|
||||
|
||||
it('syncs missed pending forms for a session', async () => {
|
||||
|
||||
Reference in new issue
Block a user