fix(cloud): show provider root items in browser
This commit is contained in:
@@ -127,9 +127,12 @@ async function load() {
|
||||
error.value = ''
|
||||
cloudStore.setBrowseState({ freshness: 'refreshing' })
|
||||
try {
|
||||
// "root" is a route-only sentinel. The browse API represents the
|
||||
// connection root by omitting parent_ref (the empty string here).
|
||||
const parentRef = folderId.value && folderId.value !== 'root' ? folderId.value : ''
|
||||
const data = await api.getCloudFoldersByConnectionId(
|
||||
connectionId.value,
|
||||
folderId.value ?? 'root'
|
||||
parentRef
|
||||
)
|
||||
items.value = data.items ?? []
|
||||
/**
|
||||
|
||||
@@ -71,10 +71,11 @@ afterEach(() => {
|
||||
})
|
||||
|
||||
describe('CloudFolderView', () => {
|
||||
it('calls getCloudFoldersByConnectionId with connection UUID, never provider slug', async () => {
|
||||
it('browses the connection root without forwarding the route-only root sentinel', async () => {
|
||||
const w = mount(CloudFolderView, { global: { stubs: globalStubs } })
|
||||
await flushPromises()
|
||||
expect(api.getCloudFoldersByConnectionId).toHaveBeenCalledWith('uuid-conn-1', 'root')
|
||||
expect(api.getCloudFoldersByConnectionId).toHaveBeenCalledWith('uuid-conn-1', '')
|
||||
expect(api.getCloudFoldersByConnectionId).not.toHaveBeenCalledWith('uuid-conn-1', 'root')
|
||||
// Never called with provider slug
|
||||
expect(api.getCloudFoldersByConnectionId).not.toHaveBeenCalledWith('google_drive', expect.anything())
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user