Skip to content

Instantly share code, notes, and snippets.

@tiagolpadua
Created July 20, 2021 01:58
Show Gist options
  • Save tiagolpadua/34104a57be859995329e517773cff21d to your computer and use it in GitHub Desktop.
Save tiagolpadua/34104a57be859995329e517773cff21d to your computer and use it in GitHub Desktop.
Exemplo Teste JS45
import { TestBed } from '@angular/core/testing';
import { AppComponent } from './app.component';
import { HeaderComponent } from './components/header/header.component';
describe('AppComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [
AppComponent,
HeaderComponent
],
}).compileComponents();
});
it('should create the app', () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app).toBeTruthy();
});
it(`should have as title 'cmail'`, () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app.title).toEqual('meu cmail');
});
it('should render title', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.nativeElement as HTMLElement;
expect(compiled.querySelector('.page-content')?.textContent).toContain('... inbox soon');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment