import { abbreviateClusterName } from '@shell/utils/cluster'; describe('fx: abbreviateClusterName', () => { it.each([ ['local', 'lcl'], ['world-wide-web', 'wwb'], ['a', 'a'], ['ab', 'ab'], ['abc', 'abc'], ['', ''], ['1', '1'], ['12', '12'], ['123', '123'], ['a1', 'a1'], ['aa1', 'aa1'], ['aaa1', 'aa1'], ['a-b', 'a-b'], ['1-2', '1-2'], ['a-b-c', 'abc'], ['abc-def-ghi', 'adi'], ['abcd-efgh', 'adh'], ['a-bc', 'abc'], ['ab-c', 'abc'], ['ab-cd', 'abd'], ['a-bcd', 'abd'], ['abc-d', 'acd'], ['0123-4567-89ab-cdef', '04f'], ['0123-4567-89ab-cdef-ghij', '04j'], ['0123-4567-8901-2345', '045'], ['0123-4567-8901-2345-6789', '049'], ['a1b', 'a1b'], ['a1b2', 'a12'], ['ab12cd34', 'a14'], ['test-cluster-one', 'tce'], ['test-cluster-1', 'tc1'], ['customer-support-team-1', 'cs1'], ['customer-support-team-one', 'cse'], ['customer-support-team-prod', 'csd'], ['customer-support-team-dev', 'csv'], ['customer-support-team-prod-1', 'cs1'], ['customer-support-team-prod-f1xz', 'csz'], ['customer-support-team-dev-1', 'cs1'], ['customer-support-team-prod-2', 'cs2'], ['customer-support-team-dev-2', 'cs2'], ['s322', 's32'], ['mew-test10', 'mt0'], ['mew-test11', 'mt1'], ['sowmya2', 'sa2'], ['sowmya4', 'sa4'], ['sowmya', 'sma'], ['sowmyatest4', 'st4'], ])('should evaluate %p as %p', (value, expected) => { const result = abbreviateClusterName(value); expect(result).toStrictEqual(expected); }); });