| 1 |
- {"ast":null,"code":"import { TestBed, async } from '@angular/core/testing';\nimport { By } from '@angular/platform-browser';\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\nimport { Router } from '@angular/router';\nimport { LoginComponent } from './login.component';\nimport { AuthService } from 'src/app/services/auth.service';\nclass AuthServiceMock {}\nclass RouterMock {}\ndescribe('LoginComponent', () => {\n let component;\n let fixture;\n beforeEach(async(() => {\n TestBed.configureTestingModule({\n imports: [FormsModule, ReactiveFormsModule],\n declarations: [LoginComponent],\n providers: [{\n provide: Router,\n useClass: RouterMock\n }, {\n provide: AuthService,\n useClass: AuthServiceMock\n }]\n }).compileComponents();\n }));\n beforeEach(() => {\n fixture = TestBed.createComponent(LoginComponent);\n component = fixture.componentInstance;\n fixture.detectChanges();\n });\n it('should create', () => {\n expect(component).toBeTruthy();\n });\n it('should display the page header text', () => {\n const el = fixture.debugElement.query(By.css('h1')).nativeElement;\n expect(el.textContent).toContain('Connexion');\n });\n it('should display the username and password inputs', () => {\n const [inputUsername, inputPassword] = fixture.debugElement.queryAll(By.css('input'));\n expect(inputUsername.nativeElement).toBeTruthy();\n expect(inputPassword.nativeElement).toBeTruthy();\n expect(inputUsername.nativeElement.value).toBeFalsy();\n expect(inputPassword.nativeElement.value).toBeFalsy();\n });\n it('should display the login button', () => {\n const el = fixture.debugElement.query(By.css('button')).nativeElement;\n expect(el).toBeTruthy();\n expect(el.textContent).toContain('Connexion');\n expect(el.disabled).toBeTruthy();\n });\n});","map":{"version":3,"names":["TestBed","async","By","FormsModule","ReactiveFormsModule","Router","LoginComponent","AuthService","AuthServiceMock","RouterMock","describe","component","fixture","beforeEach","configureTestingModule","imports","declarations","providers","provide","useClass","compileComponents","createComponent","componentInstance","detectChanges","it","expect","toBeTruthy","el","debugElement","query","css","nativeElement","textContent","toContain","inputUsername","inputPassword","queryAll","value","toBeFalsy","disabled"],"sources":["C:\\FatboarProject\\angular-client\\src\\app\\components\\login\\login.component.spec.ts"],"sourcesContent":["import { ComponentFixture, TestBed, async } from '@angular/core/testing';\r\nimport { By } from '@angular/platform-browser';\r\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\r\nimport { Router } from '@angular/router';\r\n\r\nimport { LoginComponent } from './login.component';\r\nimport { AuthService } from 'src/app/services/auth.service';\r\n\r\n\r\nclass AuthServiceMock { }\r\nclass RouterMock { }\r\n\r\n\r\n\r\ndescribe('LoginComponent', () => {\r\n let component: LoginComponent;\r\n let fixture: ComponentFixture<LoginComponent>;\r\n\r\n beforeEach(async(() => {\r\n TestBed.configureTestingModule({\r\n imports: [ FormsModule, ReactiveFormsModule ],\r\n declarations: [ LoginComponent ],\r\n providers: [\r\n { provide: Router, useClass: RouterMock },\r\n { provide: AuthService, useClass: AuthServiceMock }\r\n ]\r\n })\r\n .compileComponents();\r\n }));\r\n\r\n beforeEach(() => {\r\n fixture = TestBed.createComponent(LoginComponent);\r\n component = fixture.componentInstance;\r\n fixture.detectChanges();\r\n });\r\n\r\n it('should create', () => {\r\n expect(component).toBeTruthy();\r\n });\r\n\r\n it('should display the page header text', () => {\r\n const el = fixture.debugElement.query(By.css('h1')).nativeElement;\r\n expect(el.textContent).toContain('Connexion');\r\n });\r\n\r\n it('should display the username and password inputs', () => {\r\n const [inputUsername, inputPassword] = fixture.debugElement.queryAll(By.css('input'));\r\n expect(inputUsername.nativeElement).toBeTruthy();\r\n expect(inputPassword.nativeElement).toBeTruthy();\r\n expect(inputUsername.nativeElement.value).toBeFalsy();\r\n expect(inputPassword.nativeElement.value).toBeFalsy();\r\n });\r\n\r\n it('should display the login button', () => {\r\n const el = fixture.debugElement.query(By.css('button')).nativeElement;\r\n expect(el).toBeTruthy();\r\n expect(el.textContent).toContain('Connexion');\r\n expect(el.disabled).toBeTruthy();\r\n });\r\n\r\n});\r\n"],"mappings":"AAAA,SAA2BA,OAAO,EAAEC,KAAK,QAAQ,uBAAuB;AACxE,SAASC,EAAE,QAAQ,2BAA2B;AAC9C,SAASC,WAAW,EAAEC,mBAAmB,QA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