All files / components/Utils HomePageBackground.jsx

100% Statements 16/16
100% Branches 10/10
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 17 181x 1x 1x 1x   1x 1x 56x 3x 56x 20x 53x 3x 33x 30x 30x 56x  
import BackgroundDay from "./../../../assets/HomePageBackground-day.jpg";
import BackgroundEvening from "./../../../assets/HomePageBackground-evening.jpg";
import BackgroundMorning from "./../../../assets/HomePageBackground-morning.jpg";
import BackgroundNight from "./../../../assets/HomePageBackground-night.jpg";
 
// istanbul ignore next: trivial function to ignore from coverage due to how it is structured. Should be refactored in the future so that it can be tested.
export default function getBackgroundImage(time) {
  if (time >= 6 && time < 9) {
    return BackgroundMorning;
  } else if (time >= 9 && time < 18) {
    return BackgroundDay;
  } else if (time >= 18 && time < 21) {
    return BackgroundEvening;
  } else {
    return BackgroundNight;
  }
}