lundi 22 mars 2021

Angular Jasmine Testing - Should I test model constructor Object.assign(this, values)?

I have multiple models that use the pattern below in the constructor.

The angular test coverage recommends that I test my constructors, but should I?

Thanks, in advance.

import { CafeLocation } from './cafe-location.model';
import { TasteRating } from './taste-rating.model';
import { ICoffee } from './coffee.interface';

export class Coffee implements ICoffee {
  public name: string;
  public cafe: string;
  public type: string;
  public cafeLocation: CafeLocation;
  public rating: number;
  public tasteRating: TasteRating;
  public notes?: string;

  constructor(values?: ICoffee) {
    Object.assign(this, values);
  }
}

Aucun commentaire:

Enregistrer un commentaire