Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('can show feed', () => {
expect(cmpDebugElement).toBeTruthy();
const cmp: FeedComponent = cmpDebugElement.componentInstance;
expect(cmp.feed.length).toEqual(2);
const el = cmpDebugElement.nativeElement;
expect(getDOM().querySelectorAll(el, 'li').length).toEqual(2);
const avatarLink = getDOM().querySelector(el, 'li > a[href="/users/1"]');
expect(avatarLink).toBeTruthy();
const userLink = getDOM().querySelector(el, 'li > span > a[href="/users/1"]');
expect(userLink).toBeTruthy();
const gravatarDebugElement = cmpDebugElement.query(By.directive(GravatarComponent));
expect(gravatarDebugElement).toBeTruthy();
expect(gravatarDebugElement.componentInstance.hash).toEqual('9a3f499f653f7e8d4c5bf3ae0cf6418f');
expect(gravatarDebugElement.componentInstance.alt).toEqual('test user1');
const firstItem = getDOM().querySelector(el, 'li');
expect(firstItem.innerText).toMatch(/test user1/);
expect(firstItem.innerText).toMatch(/content1/);
expect(firstItem.innerText).toMatch(/1 day ago/);
const el = cmpDebugElement.nativeElement;
expect(getDOM().querySelectorAll(el, 'li').length).toEqual(2);
const avatarLink = getDOM().querySelector(el, 'li > a[href="/users/1"]');
expect(avatarLink).toBeTruthy();
const userLink = getDOM().querySelector(el, 'li > span > a[href="/users/1"]');
expect(userLink).toBeTruthy();
const gravatarDebugElement = cmpDebugElement.query(By.directive(GravatarComponent));
expect(gravatarDebugElement).toBeTruthy();
expect(gravatarDebugElement.componentInstance.hash).toEqual('9a3f499f653f7e8d4c5bf3ae0cf6418f');
expect(gravatarDebugElement.componentInstance.alt).toEqual('test user1');
const firstItem = getDOM().querySelector(el, 'li');
expect(firstItem.innerText).toMatch(/test user1/);
expect(firstItem.innerText).toMatch(/content1/);
expect(firstItem.innerText).toMatch(/1 day ago/);
expect(firstItem.innerText).toMatch(/delete/);
const lastItem = getDOM().querySelector(el, 'li:last-child');
expect(lastItem.innerText).not.toMatch(/delete/);
});