54 lines
1.9 KiB
TypeScript
54 lines
1.9 KiB
TypeScript
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
|
|
import { NavBarComponent } from './nav-bar.component';
|
|
import { provideRouter } from '@angular/router';
|
|
import { User } from '@app/domain/users/user.model';
|
|
import { AUTH_REPOSITORY_TOKEN } from '@app/infrastructure/authentification/auth-repository.token';
|
|
import { AuthRepository } from '@app/domain/authentification/auth.repository';
|
|
import { PROFILE_REPOSITORY_TOKEN } from '@app/infrastructure/profiles/profile-repository.token';
|
|
import { ProfileRepository } from '@app/domain/profiles/profile.repository';
|
|
import { mockProfileRepo } from '@app/testing/profile.mock';
|
|
import { mockAuthRepo } from '@app/testing/auth.mock';
|
|
import { ToastrService } from 'ngx-toastr';
|
|
import { mockToastR } from '@app/testing/toastr.mock';
|
|
|
|
describe('NavBarComponent', () => {
|
|
let component: NavBarComponent;
|
|
let fixture: ComponentFixture<NavBarComponent>;
|
|
|
|
let mockAuthRepository: jest.Mocked<Partial<AuthRepository>> = mockAuthRepo;
|
|
let mockProfileRepository: jest.Mocked<Partial<ProfileRepository>> = mockProfileRepo;
|
|
|
|
const user: User = {
|
|
id: 'adbc123',
|
|
username: 'john_doe',
|
|
verified: true,
|
|
emailVisibility: false,
|
|
email: 'jd@example.com',
|
|
created: new Date().toString(),
|
|
updated: new Date().toString(),
|
|
name: 'john doe',
|
|
avatar: '',
|
|
};
|
|
|
|
beforeEach(async () => {
|
|
await TestBed.configureTestingModule({
|
|
imports: [NavBarComponent],
|
|
providers: [
|
|
provideRouter([]),
|
|
{ provide: ToastrService, useValue: mockToastR },
|
|
{ provide: AUTH_REPOSITORY_TOKEN, useValue: mockAuthRepository },
|
|
{ provide: PROFILE_REPOSITORY_TOKEN, useValue: mockProfileRepository },
|
|
],
|
|
}).compileComponents();
|
|
|
|
fixture = TestBed.createComponent(NavBarComponent);
|
|
component = fixture.componentInstance;
|
|
fixture.detectChanges();
|
|
});
|
|
|
|
it('should create', () => {
|
|
expect(component).toBeTruthy();
|
|
});
|
|
});
|