Struggling with unit testing a component and facing a hurdle. Unsure how to mock the functionality of the @Attribute decorator in my test.
Error: No provider for String!
@Component({...})
export class MyComponent {
constructor(@Attribute("handle") private handle: string) { }
}
Need guidance on what to 'provide' in my test.
{ provide: ??, useValue: "" }
UPDATE
Test setup below:
describe("MyComponent", () => {
let component: MyComponent;
beforeEach(() => {
this.injector = ReflectiveInjector.resolveAndCreate([
{ provide: ??, useValue: "" }, //@Attribute provider??
... // other mocked providers
MyComponent
]);
component = this.injector.get(MyComponent);
});
...
});