Skip to content

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

@blalasaadri

Description

@blalasaadri

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions