All files / src/models emails.js

100% Statements 16/16
100% Branches 4/4
100% Functions 1/1
100% Lines 16/16

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 17193x 193x 193x 193x 193x 193x 193x 193x 193x 7x 5x 4x 4x 4x 4x 7x  
import { todo_getEmailAddresses as getEmailAddresses } from '@clevercloud/client/esm/api/v2/user.js';
import { sendToApi } from './send-to-api.js';
import * as User from './user.js';
 
/**
 * Get the primary and secondary email addresses of the current user
 * @returns {Promise<{ primary: string, secondary: string[] }>} The primary and secondary email addresses of the current user
 */
export async function getUserEmailAddresses() {
  const currentUser = await User.getCurrent();
  const secondaryAddresses = await getEmailAddresses().then(sendToApi);
  return {
    primary: currentUser.email,
    secondary: secondaryAddresses.sort(),
  };
}