lundi 3 août 2020

Angular 6 service unit test - verify attribute

How to unit test this function?

private results: Array<any>;

public getPropertyValueByName(propertyName: string): string {

    const object = this.results.find(obj => obj.name === propertyName);

    if (!!object && object.name === propertyName) {
        return object.value;
    }
 
    return null;
}

Aucun commentaire:

Enregistrer un commentaire