Skip to content

Commit 1a0d0a5

Browse files
authored
fix(transformPath): do not use fair relative path (#2839)
1 parent de83881 commit 1a0d0a5

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/containers/Tenant/ObjectSummary/__test__/transformPath.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {EPathType} from '../../../../types/api/schema';
22
import {isDomain, transformPath} from '../transformPath';
33

4-
describe.only('transformPath', () => {
4+
describe('transformPath', () => {
55
test.each([
66
// Tests with various combinations of path and dbName
77
['/prod/v1/sth', '/prod', 'v1/sth'],
@@ -10,8 +10,8 @@ describe.only('transformPath', () => {
1010
['/prod/v1/sth', 'prod/v1', 'sth'],
1111
['/dev/v1/sth', '/dev', 'v1/sth'],
1212
['/dev/v1/sth', 'dev', 'v1/sth'],
13-
['/dev', '/dev', ''],
14-
['/dev', 'dev', ''],
13+
['/dev', '/dev', '/dev'],
14+
['/dev', 'dev', '/dev'],
1515
['/', '/dev', '/'],
1616
['/', 'dev', '/'],
1717
['', '/dev', '/'],
@@ -33,8 +33,8 @@ describe.only('transformPath', () => {
3333
test('handles root dbName', () => {
3434
expect(transformPath('/v1/sth', '/')).toBe('v1/sth');
3535
expect(transformPath('/v1/sth', '')).toBe('v1/sth');
36-
expect(transformPath('/', '/')).toBe('');
37-
expect(transformPath('', '')).toBe('');
36+
expect(transformPath('/', '/')).toBe('/');
37+
expect(transformPath('', '')).toBe('/');
3838
});
3939

4040
test('handles paths with multiple leading slashes', () => {

src/containers/Tenant/ObjectSummary/transformPath.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export function transformPath(path: string, dbName: string): string {
99
return normalizedPath || '/';
1010
}
1111
if (normalizedPath === normalizedDbName) {
12-
return '';
12+
return `/${normalizedPath}`;
1313
}
1414

1515
let result = normalizedPath.slice(normalizedDbName.length);

src/containers/Tenant/utils/schemaActions.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ export const getActions =
204204
},
205205
],
206206
};
207-
const DB_SET: ActionsSet = [[connectToDBItem], createEntitiesSet];
207+
const DB_SET: ActionsSet = [[copyItem, connectToDBItem], createEntitiesSet];
208208

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

0 commit comments

Comments
 (0)