When working with Angular 2 testing utilities, I usually follow this process:
fixture = TestBed.createComponent(EditableValueComponent);
The EditableValueComponent is just a standard component class that I use.
I am curious about the inner workings:
static createComponent<T>(component: Type<T>): ComponentFixture<T>;
This has me thinking, as I want to streamline certain testing procedures:
export class SuperFixture<T>
{
fixture: ComponentFixture<T>;
component: T;
constructor()
{
this.fixture = TestBed.createComponent(T); // <--- encountered an issue here!
this.component = this.fixture.componentInstance;
}
}
The problem at hand is described as follows:
'T' only refers to a type, but is being used as a value here.'
EDIT #1
To resolve the issue, I made the following adjustment:
constructor(component)
{
this.fixture = TestBed.createComponent<T>(component);
Even after resolving it, the mechanics behind it all still puzzle me.