-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: use relative entity path in schema actions #1366
Conversation
@@ -14,3 +19,19 @@ export function transformPath(path: string, dbName: string): string { | |||
|
|||
return result; | |||
} | |||
|
|||
export function isDomain(path: string, type?: EPathType) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some tests would be very great
@@ -14,3 +19,19 @@ export function transformPath(path: string, dbName: string): string { | |||
|
|||
return result; | |||
} | |||
|
|||
export function isDomain(path: string, type?: EPathType) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export function isDomain(path: string, type?: EPathType): boolean {
if (type !== EPathType.EPathTypeDir) {
return false;
}
return path.split('/').length === 2 && path.startsWith('/');
}
@@ -14,3 +19,19 @@ export function transformPath(path: string, dbName: string): string { | |||
|
|||
return result; | |||
} | |||
|
|||
export function isDomain(path: string, type?: EPathType) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if these tests return what expected
Double check them please
import { isDomain } from './path-utils';
import { EPathType } from './types';
describe('isDomain', () => {
it('should return true for valid domain paths', () => {
expect(isDomain('/domain', EPathType.EPathTypeDir)).toBe(true);
expect(isDomain('/another-domain', EPathType.EPathTypeDir)).toBe(true);
});
it('should return false for non-directory paths', () => {
expect(isDomain('/domain', EPathType.EPathTypeFile)).toBe(false);
expect(isDomain('/domain', undefined)).toBe(false);
});
it('should return false for paths without slash', () => {
expect(isDomain('domain', EPathType.EPathTypeDir)).toBe(false);
});
it('should return false for paths with multiple slashes', () => {
expect(isDomain('/domain/subdomain', EPathType.EPathTypeDir)).toBe(false);
expect(isDomain('/domain/', EPathType.EPathTypeDir)).toBe(false);
});
it('should return false for empty paths', () => {
expect(isDomain('', EPathType.EPathTypeDir)).toBe(false);
});
it('should return true for root path', () => {
expect(isDomain('/', EPathType.EPathTypeDir)).toBe(true);
});
});
64c65e0
to
a1e3720
Compare
CI Results
Test Status: β PASSED
π Full Report
Bundle Size: β
Current: 79.08 MB | Main: 79.08 MB
Diff: +0.00 MB (0.00%)
β Bundle size unchanged.
βΉοΈ CI Information