I trying to make test unit for this pipe with angular/typeScript:
@Pipe({
name: 'getCausesFromListCountDailyDelay'
})
export class GetCausesFromListCountDailyDelayPipe implements PipeTransform {
transform(listCountDailyDelay: ListCountDelay[]): string[] {
return listCountDailyDelay.map(count => count.cause.charAt(0) + ' ' + count.totalTime);
}
}
and when I eecute the test I have problem
error TS2339: Property 'toEqual' does not exist on type 'string[]
my test file :
it('should GetCausesFromListCountDailyDelayPipe', () => {
const listCountDailyDelay: ListCountDelay[] = [
{
centre: 'LFAF',
cause: 'CCCC',
totalTime: 5
},
{
centre: 'LFFF',
cause: 'IIII',
totalTime: 20
},
{
centre: 'LFF',
cause: 'FHHH',
totalTime: 10
},
];
const resultDatas: ListCountDelay[] = [
{
centre: 'LFAF',
cause: 'C ',
totalTime: 5
},
{
centre: 'LFFF',
cause: 'I ',
totalTime: 20
},
{
centre: 'LFF',
cause: 'F ',
totalTime: 10
},
];
expect(pipe.transform(listCountDailyDelay).toEqual(resultDatas));
});
the pipe transform return type string[] but I can not do this test with Equal or toBe !!! any idea please ?!!
Aucun commentaire:
Enregistrer un commentaire