mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 04:44:21 +01:00
loop: om-179-finish-adopting-op completed after 19 iterations
This commit is contained in:
1 parent
7c4cfd858c
commit
49bb4ebd36
25 files changed
+362
-198
No files matched your search
@@ -1,13 +1,29 @@
|
||||
import { describe, expect, it, vi } from 'vitest'
|
||||
import { getWorkspacePath } from '@opencode-manager/shared/config/env'
|
||||
import { ClientError, openCodeLocation, type OpenCodeApi } from '@opencode-manager/shared/opencode'
|
||||
import { readManagedOpenCodeConfig } from '../../src/services/opencode-config-effective'
|
||||
import { readManagedOpenCodeConfig, readOpenCodeConfigDocuments } from '../../src/services/opencode-config-effective'
|
||||
|
||||
function stubApi(entries: unknown[]) {
|
||||
const get = vi.fn(async () => entries)
|
||||
return { api: { config: { get } } as unknown as OpenCodeApi, get }
|
||||
}
|
||||
|
||||
describe('readOpenCodeConfigDocuments', () => {
|
||||
it('keys document entries by resolved path for the requested directory', async () => {
|
||||
const { api, get } = stubApi([
|
||||
{ type: 'document', path: '/directory/./opencode.json', info: { theme: 'dark' } },
|
||||
{ type: 'document', info: { theme: 'pathless' } },
|
||||
{ type: 'directory', path: '/directory' },
|
||||
])
|
||||
|
||||
const documents = await readOpenCodeConfigDocuments(api, '/directory')
|
||||
|
||||
expect([...documents.keys()]).toEqual(['/directory/opencode.json'])
|
||||
expect(documents.get('/directory/opencode.json')).toEqual({ theme: 'dark' })
|
||||
expect(get).toHaveBeenCalledWith(openCodeLocation('/directory'))
|
||||
})
|
||||
})
|
||||
|
||||
describe('readManagedOpenCodeConfig', () => {
|
||||
it('merges only the documents whose path is a Manager source, in source order', async () => {
|
||||
const { api, get } = stubApi([
|
||||
|
||||
Reference in new issue
Block a user