Skip to content

Instantly share code, notes, and snippets.

@Hitman666
Created September 15, 2016 12:30
Show Gist options
  • Save Hitman666/e78ca0fba58d241de2f2cfde5e83b5bc to your computer and use it in GitHub Desktop.
Save Hitman666/e78ca0fba58d241de2f2cfde5e83b5bc to your computer and use it in GitHub Desktop.
/* tslint:disable:no-unused-variable */
import { TestBed, async } from '@angular/core/testing';
import { AppComponent } from './app.component';
describe('App: GiphyA2', () => {
beforeEach(() => {
TestBed.configureTestingModule({
declarations: [
AppComponent
],
});
});
it('should create the app', async(() => {
let fixture = TestBed.createComponent(AppComponent);
let app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
}));
it(`should have as title 'Welcome to GiphySearch'`, async(() => {
let fixture = TestBed.createComponent(AppComponent);
let app = fixture.debugElement.componentInstance;
expect(app.title).toEqual('Welcome to GiphySearch');
}));
it('should render title in a h1 tag', async(() => {
let fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
let compiled = fixture.debugElement.nativeElement;
expect(compiled.querySelector('h1').textContent).toContain('Welcome to GiphySearch');
}));
it(`should have a function performSearch`, async(() => {
let fixture = TestBed.createComponent(AppComponent);
let app = fixture.debugElement.componentInstance;
expect(app.performSearch).toBeTruthy();
}));
it(`should have a function performSearch return the passed in text`, async(() => {
let fixture = TestBed.createComponent(AppComponent);
let app = fixture.debugElement.componentInstance;
expect(app.performSearch("test")).toEqual('test');
}));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment