👉 Notice here,
const href = 'href';
return de.properties[href] === '/';
needs to use a variable for the string into the method, otherwise it will have a TSLint error. [2]
```diff
- Error:(32, 34) TSLint: object access via string literals is disallowed (no-string-literal)
In Angular we sometimes need to write test for simple routerLink.
e.g.
DummyComponent.html
DummyComponent.spec
describe('DummyComponent', () => { let component: DummyComponent; let fixture: ComponentFixture;
});
Reference
[1] https://stackoverflow.com/questions/39577920/angular-2-unit-testing-components-with-routerlink [2] https://stackoverflow.com/questions/33387090/how-to-rewrite-code-to-avoid-tslint-object-access-via-string-literals