forked from CenterForOpenScience/angular-osf
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrequest-access.component.spec.ts
More file actions
49 lines (38 loc) · 1.53 KB
/
Copy pathrequest-access.component.spec.ts
File metadata and controls
49 lines (38 loc) · 1.53 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
import { Store } from '@ngxs/store';
import { TranslatePipe } from '@ngx-translate/core';
import { MockPipe, MockProvider } from 'ng-mocks';
import { of } from 'rxjs';
import { provideHttpClient } from '@angular/common/http';
import { provideHttpClientTesting } from '@angular/common/http/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ActivatedRoute } from '@angular/router';
import { ToastService } from '@osf/shared/services';
import { RequestAccessComponent } from './request-access.component';
describe.only('RequestAccessComponent', () => {
let component: RequestAccessComponent;
let fixture: ComponentFixture<RequestAccessComponent>;
const mockStore: jest.Mocked<Store> = {
dispatch: jest.fn().mockResolvedValue(undefined) as any,
select: jest.fn().mockReturnValue(of(undefined)) as any,
selectSnapshot: jest.fn() as any,
reset: jest.fn() as any,
} as any;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [RequestAccessComponent, MockPipe(TranslatePipe)],
providers: [
provideHttpClient(),
provideHttpClientTesting(),
MockProvider(ToastService),
MockProvider(ActivatedRoute, { params: of({}) }),
],
}).compileComponents();
TestBed.overrideProvider(Store, { useValue: mockStore });
fixture = TestBed.createComponent(RequestAccessComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});