All files / lib/dns/delegation-record-handler utils.ts

93.33% Statements 14/15
75% Branches 3/4
100% Functions 3/3
91.67% Lines 11/12

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 243x 3x 4x     3x 3x     3x 3x 3x 3x         3x   1x        
const DNS_UPDATE_ROLE_SUFFIX = '-dns-update';
export const getDNSUpdateRoleNameFromSubZoneName = (subZoneName: string) => {
  return `${subZoneName}${DNS_UPDATE_ROLE_SUFFIX}`.toLocaleLowerCase();
}
 
export const getSubdomainPrefix = (accountName: string | undefined, accountStageName: string | undefined) => {
  Iif(!accountName) {
    throw new Error(`accountName needs to be provided. aborting.`);
  }
  let prefix: string = accountStageName ? accountStageName : accountName!;
  prefix = prefix.toLowerCase();
  prefix = prefix.replace(' ', '-');
  return prefix;
}
 
 
 
export const getDNSUpdateRoleNameFromServiceRecordName = (serviceRecordName: string) => {
   // Keep only the root domain as it is used for the role name "landingpage.dev.ilovemylocalfarmer.dev".split('.').splice(1).join('.') => 'dev.ilovemylocalfarmer.dev'
  return getDNSUpdateRoleNameFromSubZoneName(serviceRecordName
    .split(".")
    .splice(1)
    .join("."));
}