Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {EPathType} from '../../../../types/api/schema';
import {isDomain, transformPath} from '../transformPath';

describe.only('transformPath', () => {
describe('transformPath', () => {
test.each([
// Tests with various combinations of path and dbName
['/prod/v1/sth', '/prod', 'v1/sth'],
Expand All @@ -10,8 +10,8 @@ describe.only('transformPath', () => {
['/prod/v1/sth', 'prod/v1', 'sth'],
['/dev/v1/sth', '/dev', 'v1/sth'],
['/dev/v1/sth', 'dev', 'v1/sth'],
['/dev', '/dev', ''],
['/dev', 'dev', ''],
['/dev', '/dev', '/dev'],
['/dev', 'dev', '/dev'],
['/', '/dev', '/'],
['/', 'dev', '/'],
['', '/dev', '/'],
Expand All @@ -33,8 +33,8 @@ describe.only('transformPath', () => {
test('handles root dbName', () => {
expect(transformPath('/v1/sth', '/')).toBe('v1/sth');
expect(transformPath('/v1/sth', '')).toBe('v1/sth');
expect(transformPath('/', '/')).toBe('');
expect(transformPath('', '')).toBe('');
expect(transformPath('/', '/')).toBe('/');
expect(transformPath('', '')).toBe('/');
});

test('handles paths with multiple leading slashes', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/containers/Tenant/ObjectSummary/transformPath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export function transformPath(path: string, dbName: string): string {
return normalizedPath || '/';
}
if (normalizedPath === normalizedDbName) {
return '';
return `/${normalizedPath}`;
}

let result = normalizedPath.slice(normalizedDbName.length);
Expand Down
2 changes: 1 addition & 1 deletion src/containers/Tenant/utils/schemaActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ export const getActions =
},
],
};
const DB_SET: ActionsSet = [[connectToDBItem], createEntitiesSet];
const DB_SET: ActionsSet = [[copyItem, connectToDBItem], createEntitiesSet];

const DIR_SET: ActionsSet = [[copyItem], createEntitiesSet];

Expand Down
Loading