forked from DSpace/dspace-angular
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathlogin-page.component.spec.ts
More file actions
63 lines (56 loc) · 2.14 KB
/
Copy pathlogin-page.component.spec.ts
File metadata and controls
63 lines (56 loc) · 2.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import { NO_ERRORS_SCHEMA } from '@angular/core';
import {
ComponentFixture,
TestBed,
waitForAsync,
} from '@angular/core/testing';
import { ActivatedRoute } from '@angular/router';
import { Store } from '@ngrx/store';
import { provideMockStore } from '@ngrx/store/testing';
import { TranslateModule } from '@ngx-translate/core';
import { of } from 'rxjs';
import { APP_DATA_SERVICES_MAP } from '../../config/app-config.interface';
import { AuthService } from '../core/auth/auth.service';
import { LocaleService } from '../core/locale/locale.service';
import { XSRFService } from '../core/xsrf/xsrf.service';
import { AuthServiceMock } from '../shared/mocks/auth.service.mock';
import { ActivatedRouteStub } from '../shared/testing/active-router.stub';
import { LoginPageComponent } from './login-page.component';
describe('LoginPageComponent', () => {
let comp: LoginPageComponent;
let fixture: ComponentFixture<LoginPageComponent>;
const activatedRouteStub = Object.assign(new ActivatedRouteStub(), {
params: of({}),
});
const store: Store<LoginPageComponent> = jasmine.createSpyObj('store', {
/* eslint-disable no-empty,@typescript-eslint/no-empty-function */
dispatch: {},
/* eslint-enable no-empty, @typescript-eslint/no-empty-function */
select: of(true),
});
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [
TranslateModule.forRoot(),
LoginPageComponent,
],
providers: [
{ provide: ActivatedRoute, useValue: activatedRouteStub },
{ provide: AuthService, useValue: new AuthServiceMock() },
{ provide: XSRFService, useValue: {} },
{ provide: APP_DATA_SERVICES_MAP, useValue: {} },
{ provide: LocaleService, useValue: { getCurrentLanguageCode: () => 'en' } },
provideMockStore({}),
],
schemas: [NO_ERRORS_SCHEMA],
}).compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(LoginPageComponent);
comp = fixture.componentInstance; // SearchPageComponent test instance
fixture.detectChanges();
});
it('should create instance', () => {
expect(comp).toBeDefined();
});
});