We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 86b504f commit 55898c8Copy full SHA for 55898c8
packages/orchestrator-ui-components/src/utils/uuid.spec.ts
@@ -5,6 +5,11 @@ describe('getFirstUuidPart()', () => {
5
const result = getFirstUuidPart('12345678-1234-1234-1234-123456789abc');
6
expect(result).toEqual('12345678');
7
});
8
+
9
+ it('returns empty string for empty uuid', () => {
10
+ const result = getFirstUuidPart();
11
+ expect(result).toEqual('');
12
+ });
13
14
15
describe('isUuid4()', () => {
packages/orchestrator-ui-components/src/utils/uuid.ts
@@ -1,4 +1,5 @@
1
-export const getFirstUuidPart = (uuid: string): string => uuid.slice(0, 8);
+export const getFirstUuidPart = (uuid?: string): string =>
2
+ uuid ? uuid.slice(0, 8) : '';
3
4
export const isUuid4 = (value: string): boolean =>
!!value.match(
0 commit comments