Skip to content

Commit

Permalink
update test file
Browse files Browse the repository at this point in the history
  • Loading branch information
GspikeHalo committed Jan 16, 2025
1 parent b3812dc commit 4e6be6a
Showing 1 changed file with 19 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,20 +1,36 @@
import { ComponentFixture, TestBed } from "@angular/core/testing";
import { GoogleLoginComponent } from "./google-login.component";
import { NO_ERRORS_SCHEMA } from "@angular/core";
import { HttpClientTestingModule } from "@angular/common/http/testing";
import { RouterTestingModule } from "@angular/router/testing";
import { UserService } from "../../../../common/service/user/user.service";
import { SocialAuthService } from "@abacritt/angularx-social-login";
import { of } from "rxjs";

describe("GoogleLoginComponent", () => {
let component: GoogleLoginComponent;
let fixture: ComponentFixture<GoogleLoginComponent>;
let userService: jasmine.SpyObj<UserService>;
let socialAuthService: jasmine.SpyObj<SocialAuthService>;

beforeEach(async () => {
const userServiceSpy = jasmine.createSpyObj("UserService", ["googleLogin"]);
const socialAuthServiceSpy = jasmine.createSpyObj("SocialAuthService", [], {
authState: of({ idToken: "mock-id-token" }),
});

await TestBed.configureTestingModule({
imports: [HttpClientTestingModule, RouterTestingModule],
declarations: [GoogleLoginComponent],
schemas: [NO_ERRORS_SCHEMA],
providers: [
{ provide: UserService, useValue: userServiceSpy },
{ provide: SocialAuthService, useValue: socialAuthServiceSpy },
],
}).compileComponents();

fixture = TestBed.createComponent(GoogleLoginComponent);
component = fixture.componentInstance;
fixture.detectChanges();
userService = TestBed.inject(UserService) as jasmine.SpyObj<UserService>;
socialAuthService = TestBed.inject(SocialAuthService) as jasmine.SpyObj<SocialAuthService>;
});

it("should create the component", () => {
Expand Down

0 comments on commit 4e6be6a

Please sign in to comment.