angular-course icon indicating copy to clipboard operation
angular-course copied to clipboard

The tests highlighted.directive.spec.ts and ngx-useless.directive.spec.ts won't compile

Open blalasaadri opened this issue 6 years ago • 0 comments
trafficstars

Expectation: Running the tests with npm test works.

Actual: The test file highlighted.directive.spec.ts currently looks like this on master:

import { HighlightedDirective } from './highlighted.directive';

describe('HighlightedDirective', () => {
  it('should create an instance', () => {
    const directive = new HighlightedDirective();
    expect(directive).toBeTruthy();
  });
});

However, the only constructor of HighlightedDirective has a non-optional argument:

constructor(private coursesService: CoursesService) {

    console.log('coursesService highlighted ' + coursesService.id);

}

A similar problem exists with ngx-useless.directive.spec.ts and ngx-useless.directive.ts, here we're missing two parameters:

constructor(private templateRef: TemplateRef<any>,
            private viewContainer: ViewContainerRef) {


}

For this reason, running npm test produces the following error message:

ERROR in src/app/courses/directives/highlighted.directive.spec.ts(5,23): error TS2554: Expected 1 arguments, but got 0.
src/app/courses/directives/ngx-unless.directive.spec.ts(5,23): error TS2554: Expected 2 arguments, but got 0.

blalasaadri avatar Jun 30 '19 17:06 blalasaadri