Allow same-basename Workspace paths
This commit is contained in:
@@ -292,18 +292,25 @@ describe('workspace.create', () => {
|
||||
}
|
||||
})
|
||||
|
||||
it('rejects different paths that derive the same Workspace title', async () => {
|
||||
it('adopts different paths that derive the same Workspace title', async () => {
|
||||
const { api, workspaceRoot } = await harness()
|
||||
const first = join(workspaceRoot, 'one', 'project')
|
||||
const second = join(workspaceRoot, 'two', 'project')
|
||||
mkdirSync(first, { recursive: true })
|
||||
mkdirSync(second, { recursive: true })
|
||||
expectOk(await api.workspace.create(request({ path: first })))
|
||||
const conflict = await api.workspace.create(request({ path: second }))
|
||||
expect(conflict.result).toMatchObject({
|
||||
ok: false,
|
||||
error: { code: 'workspace-name-conflict', details: { name: 'project' } },
|
||||
const firstResult = expectOk(await api.workspace.create(request({ path: first })))
|
||||
const secondResult = expectOk(await api.workspace.create(request({ path: second })))
|
||||
expect(firstResult).toMatchObject({
|
||||
created: true,
|
||||
workspace: { path: first, title: 'project' },
|
||||
})
|
||||
expect(secondResult).toMatchObject({
|
||||
created: true,
|
||||
workspace: { path: second, title: 'project' },
|
||||
})
|
||||
expect(secondResult.workspace.workspaceId).not.toBe(firstResult.workspace.workspaceId)
|
||||
expect(expectOk(await api.workspace.list(request({}))).items.map(workspace => workspace.path))
|
||||
.toEqual([second, first])
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user