All files / app/search/presenter/pages/github-search/models info-message.ts

100% Statements 7/7
100% Branches 0/0
100% Functions 3/3
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 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46      1x                                                               3x 3x 3x 3x       22x      
import { InfoMessageType } from './info-message-type';
 
export class InfoMessage {
  static messages: InfoMessage[] = [
    new InfoMessage(
      InfoMessageType.INTRODUCTION,
      'Search a GitHub User!',
      'Click here to start.',
      'assets/img/people-search.svg'
    ),
    new InfoMessage(
      InfoMessageType.SEARCH_ERROR,
      'We have an issue to search on GitHub.',
      'Click here to try again.',
      'assets/img/error.svg'
    ),
    new InfoMessage(
      InfoMessageType.NO_SEARCH_RESULTS,
      'No user found on GitHub Search.',
      'Click here to search another user.',
      'assets/img/no-data.svg'
    ),
  ];
 
  type: InfoMessageType;
  title: string;
  message: string;
  img: string;
 
  constructor(
    type: InfoMessageType,
    title: string,
    message: string,
    img: string
  ) {
    this.type = type;
    this.title = title;
    this.message = message;
    this.img = img;
  }
 
  public static find(type: InfoMessageType): InfoMessage | undefined {
    return InfoMessage.messages.find((message) => message.type === type);
  }
}