Advertisement
Guest User

Untitled

a guest
Jun 21st, 2022
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. export async function script1({items}: {
  2.   items: {
  3.     pass: boolean;
  4.     name: string;
  5.     error?: string;
  6.     estimate?: string;
  7.   }[];
  8. }): Promise<{
  9.   pass: boolean;
  10.   report: string;
  11. }> {
  12.   return {
  13.     pass: items.reduce((all, {pass}) => all && pass, true),
  14.     report: items.map(item => {
  15.       if (item.pass) {
  16.         return `OK ${item.name}`;
  17.       }
  18.       return `NOT OK ${item.name}${item.error ? `\n${item.error}\n` : ''}${item.estimate ? `\Expected time to resolution: ${item.estimate}\n\n` : ''}`;
  19.     }).join('\n')
  20.   };
  21. }
  22.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement