All files / apps/chatbot/src/utils greeting.ts

100% Statements 9/9
100% Branches 13/13
100% Functions 1/1
100% Lines 6/6

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  2x 19x 19x 17x 4x 2x    
/** Time-of-day greeting shown above the welcome message. */
export const getGreeting = (now: Date = new Date()): string => {
  const hour = now.getHours();
  if (hour >= 5 && hour < 12) return "Good morning";
  if (hour >= 12 && hour < 18) return "Good afternoon";
  if (hour >= 18 && hour < 22) return "Good evening";
  return "Hi";
};