Skip to content

Commit

Permalink
Corrige arquivos de testes geral
Browse files Browse the repository at this point in the history
  • Loading branch information
joao15victor08 committed Nov 6, 2023
1 parent 4631b5d commit b6108c5
Show file tree
Hide file tree
Showing 11 changed files with 53 additions and 28 deletions.
1 change: 1 addition & 0 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ module.exports = function (config) {
{ type: 'html' },
{ type: 'lcov' },
{ type: 'cobertura' },
{ type: 'text-summary' }
]
},
reporters: ['progress', 'kjhtml'],
Expand Down
16 changes: 11 additions & 5 deletions src/app/app.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
import { TestBed } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { AppComponent } from './app.component';
import { BackgroundComponent } from './components/background/background.component';

describe('AppComponent', () => {
let component: AppComponent;
let fixture: ComponentFixture<AppComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [RouterTestingModule],
declarations: [AppComponent],
declarations: [AppComponent, BackgroundComponent],
}).compileComponents();

fixture = TestBed.createComponent(AppComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create the app', () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app).toBeTruthy();
expect(component).toBeTruthy();
});
});
10 changes: 7 additions & 3 deletions src/app/pages/active-account/active-account.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { ActiveAccountComponent } from './active-account.component';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { AuthService } from 'src/app/services/auth.service';
import { ReactiveFormsModule } from '@angular/forms';

describe('ActiveAccountComponent', () => {
let component: ActiveAccountComponent;
let fixture: ComponentFixture<ActiveAccountComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ ActiveAccountComponent ]
imports: [HttpClientTestingModule, ReactiveFormsModule],
providers: [AuthService],
declarations: [ActiveAccountComponent]
})
.compileComponents();
.compileComponents();

fixture = TestBed.createComponent(ActiveAccountComponent);
component = fixture.componentInstance;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { CheckCodeRestPasswordComponent } from './check-code-rest-password.component';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { AuthService } from 'src/app/services/auth.service';
import { ReactiveFormsModule } from '@angular/forms';

describe('CheckCodeRestPasswordComponent', () => {
let component: CheckCodeRestPasswordComponent;
let fixture: ComponentFixture<CheckCodeRestPasswordComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ CheckCodeRestPasswordComponent ]
imports: [HttpClientTestingModule, ReactiveFormsModule],
providers: [AuthService],
declarations: [CheckCodeRestPasswordComponent]
})
.compileComponents();
.compileComponents();

fixture = TestBed.createComponent(CheckCodeRestPasswordComponent);
component = fixture.componentInstance;
Expand Down
9 changes: 6 additions & 3 deletions src/app/pages/edit-user/edit-user.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { EditUserComponent } from './edit-user.component';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { ReactiveFormsModule } from '@angular/forms';

describe('EditUserComponent', () => {
let component: EditUserComponent;
let fixture: ComponentFixture<EditUserComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ EditUserComponent ]
imports: [HttpClientTestingModule, RouterTestingModule, ReactiveFormsModule],
declarations: [EditUserComponent]
})
.compileComponents();
.compileComponents();

fixture = TestBed.createComponent(EditUserComponent);
component = fixture.componentInstance;
Expand Down
6 changes: 4 additions & 2 deletions src/app/pages/login/login.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { LoginComponent } from './login.component';
import { FormBuilder, ReactiveFormsModule } from '@angular/forms';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { AuthService } from 'src/app/services/auth.service';

describe('LoginComponent', () => {
let component: LoginComponent;
let fixture: ComponentFixture<LoginComponent>;

beforeEach(async () => {
TestBed.configureTestingModule({
imports: [HttpClientTestingModule, ReactiveFormsModule],
providers: [FormBuilder, AuthService],
declarations: [LoginComponent],
imports: [ReactiveFormsModule],
providers: [FormBuilder],
}).compileComponents();

fixture = TestBed.createComponent(LoginComponent);
Expand Down
7 changes: 4 additions & 3 deletions src/app/pages/profile/profile.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { ProfileComponent } from './profile.component';
import { HttpClientTestingModule } from '@angular/common/http/testing';

describe('ProfileComponent', () => {
let component: ProfileComponent;
let fixture: ComponentFixture<ProfileComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ ProfileComponent ]
imports: [HttpClientTestingModule],
declarations: [ProfileComponent]
})
.compileComponents();
.compileComponents();

fixture = TestBed.createComponent(ProfileComponent);
component = fixture.componentInstance;
Expand Down
10 changes: 7 additions & 3 deletions src/app/pages/register/register.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { RegisterComponent } from './register.component';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { AuthService } from 'src/app/services/auth.service';
import { ReactiveFormsModule } from '@angular/forms';

describe('RegisterComponent', () => {
let component: RegisterComponent;
let fixture: ComponentFixture<RegisterComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ RegisterComponent ]
imports: [HttpClientTestingModule, ReactiveFormsModule],
providers: [AuthService],
declarations: [RegisterComponent]
})
.compileComponents();
.compileComponents();

fixture = TestBed.createComponent(RegisterComponent);
component = fixture.componentInstance;
Expand Down
4 changes: 2 additions & 2 deletions src/app/services/auth.guard.spec.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { TestBed } from '@angular/core/testing';

import { HttpClientTestingModule } from '@angular/common/http/testing';
import { AuthGuard } from './auth.guard';

describe('AuthGuard', () => {
let guard: AuthGuard;

beforeEach(() => {
TestBed.configureTestingModule({});
TestBed.configureTestingModule({ imports: [HttpClientTestingModule], providers: [AuthGuard] });
guard = TestBed.inject(AuthGuard);
});

Expand Down
4 changes: 2 additions & 2 deletions src/app/services/auth.service.spec.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { TestBed } from '@angular/core/testing';

import { HttpClientTestingModule } from '@angular/common/http/testing';
import { AuthService } from './auth.service';

describe('AuthService', () => {
let service: AuthService;

beforeEach(() => {
TestBed.configureTestingModule({});
TestBed.configureTestingModule({ imports: [HttpClientTestingModule], providers: [AuthService] });
service = TestBed.inject(AuthService);
});

Expand Down
4 changes: 2 additions & 2 deletions src/app/services/user.service.spec.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { TestBed } from '@angular/core/testing';

import { UserService } from './user.service';
import { HttpClientTestingModule } from '@angular/common/http/testing';

describe('UserService', () => {
let service: UserService;

beforeEach(() => {
TestBed.configureTestingModule({});
TestBed.configureTestingModule({ imports: [HttpClientTestingModule], providers: [UserService] });
service = TestBed.inject(UserService);
});

Expand Down

0 comments on commit b6108c5

Please sign in to comment.