Created
July 20, 2021 01:58
-
-
Save tiagolpadua/34104a57be859995329e517773cff21d to your computer and use it in GitHub Desktop.
Exemplo Teste JS45
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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