test(aio): fix DocViewerComponent tests (#23359)

Obsolete assertions left over from #23249.

PR Close #23359
This commit is contained in:
George Kalpakas 2018-04-13 14:48:44 +03:00 committed by Igor Minar
parent 75d1ab9065
commit a3204f87fd
2 changed files with 4 additions and 15 deletions

View File

@ -162,15 +162,12 @@ describe('site App', function() {
describe('404 page', () => {
it('should add or remove the "noindex" meta tag depending upon the validity of the page', () => {
page.navigateTo('');
expect(element(by.css('meta[name="googlebot"]')).isPresent()).toBeFalsy();
expect(element(by.css('meta[name="robots"]')).isPresent()).toBeFalsy();
page.navigateTo('does/not/exist');
expect(element(by.css('meta[name="googlebot"][content="noindex"]')).isPresent()).toBeTruthy();
expect(element(by.css('meta[name="robots"][content="noindex"]')).isPresent()).toBeTruthy();
page.click(page.getTopMenuLink('features'));
expect(element(by.css('meta[name="googlebot"]')).isPresent()).toBeFalsy();
expect(element(by.css('meta[name="robots"]')).isPresent()).toBeFalsy();
});

View File

@ -1,6 +1,6 @@
import { ComponentRef } from '@angular/core';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { Title, Meta } from '@angular/platform-browser';
import { Meta, Title } from '@angular/platform-browser';
import { Observable } from 'rxjs/Observable';
import { of } from 'rxjs/observable/of';
@ -415,21 +415,18 @@ describe('DocViewerComponent', () => {
expect(addTitleAndTocSpy).toHaveBeenCalledTimes(4);
});
it('should remove "noindex" meta tags if the document is valid', async () => {
it('should remove the "noindex" meta tag if the document is valid', async () => {
await doRender('foo', 'bar');
expect(TestBed.get(Meta).removeTag).toHaveBeenCalledWith('name="googlebot"');
expect(TestBed.get(Meta).removeTag).toHaveBeenCalledWith('name="robots"');
});
it('should add "noindex" meta tags if the document is 404', async () => {
it('should add the "noindex" meta tag if the document is 404', async () => {
await doRender('missing', FILE_NOT_FOUND_ID);
expect(TestBed.get(Meta).addTag).toHaveBeenCalledWith({ name: 'googlebot', content: 'noindex' });
expect(TestBed.get(Meta).addTag).toHaveBeenCalledWith({ name: 'robots', content: 'noindex' });
});
it('should add "noindex" meta tags if the document fetching fails', async () => {
it('should add a "noindex" meta tag if the document fetching fails', async () => {
await doRender('error', FETCHING_ERROR_ID);
expect(TestBed.get(Meta).addTag).toHaveBeenCalledWith({ name: 'googlebot', content: 'noindex' });
expect(TestBed.get(Meta).addTag).toHaveBeenCalledWith({ name: 'robots', content: 'noindex' });
});
});
@ -558,7 +555,6 @@ describe('DocViewerComponent', () => {
[jasmine.any(Error)]
]);
expect(logger.output.error[0][0].message).toEqual(`[DocViewer] Error preparing document 'foo': ${error.stack}`);
expect(TestBed.get(Meta).addTag).toHaveBeenCalledWith({ name: 'googlebot', content: 'noindex' });
expect(TestBed.get(Meta).addTag).toHaveBeenCalledWith({ name: 'robots', content: 'noindex' });
});
@ -580,7 +576,6 @@ describe('DocViewerComponent', () => {
[jasmine.any(Error)]
]);
expect(logger.output.error[0][0].message).toEqual(`[DocViewer] Error preparing document 'bar': ${error.stack}`);
expect(TestBed.get(Meta).addTag).toHaveBeenCalledWith({ name: 'googlebot', content: 'noindex' });
expect(TestBed.get(Meta).addTag).toHaveBeenCalledWith({ name: 'robots', content: 'noindex' });
});
@ -602,7 +597,6 @@ describe('DocViewerComponent', () => {
[jasmine.any(Error)]
]);
expect(logger.output.error[0][0].message).toEqual(`[DocViewer] Error preparing document 'baz': ${error.stack}`);
expect(TestBed.get(Meta).addTag).toHaveBeenCalledWith({ name: 'googlebot', content: 'noindex' });
expect(TestBed.get(Meta).addTag).toHaveBeenCalledWith({ name: 'robots', content: 'noindex' });
});
@ -624,7 +618,6 @@ describe('DocViewerComponent', () => {
[jasmine.any(Error)]
]);
expect(logger.output.error[0][0].message).toEqual(`[DocViewer] Error preparing document 'qux': ${error.stack}`);
expect(TestBed.get(Meta).addTag).toHaveBeenCalledWith({ name: 'googlebot', content: 'noindex' });
expect(TestBed.get(Meta).addTag).toHaveBeenCalledWith({ name: 'robots', content: 'noindex' });
});
@ -643,7 +636,6 @@ describe('DocViewerComponent', () => {
[jasmine.any(Error)]
]);
expect(logger.output.error[0][0].message).toEqual(`[DocViewer] Error preparing document 'qux': ${error}`);
expect(TestBed.get(Meta).addTag).toHaveBeenCalledWith({ name: 'googlebot', content: 'noindex' });
expect(TestBed.get(Meta).addTag).toHaveBeenCalledWith({ name: 'robots', content: 'noindex' });
});
});