Skip to content

Commit 94d00c8

Browse files
committed
chore(test-updates): removed a file
1 parent 6e66be3 commit 94d00c8

File tree

8 files changed

+53
-17
lines changed

8 files changed

+53
-17
lines changed

src/app/features/files/components/file-keywords/file-keywords.component.spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
22

33
import { FileKeywordsComponent } from './file-keywords.component';
44

5+
import { OSFTestingModule } from '@testing/osf.testing.module';
6+
57
describe('FileKeywordsComponent', () => {
68
let component: FileKeywordsComponent;
79
let fixture: ComponentFixture<FileKeywordsComponent>;
810

911
beforeEach(async () => {
1012
await TestBed.configureTestingModule({
11-
imports: [FileKeywordsComponent],
13+
imports: [FileKeywordsComponent, OSFTestingModule],
1214
}).compileComponents();
1315

1416
fixture = TestBed.createComponent(FileKeywordsComponent);

src/app/features/files/components/file-metadata/file-metadata.component.spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
22

33
import { FileMetadataComponent } from './file-metadata.component';
44

5+
import { OSFTestingModule } from '@testing/osf.testing.module';
6+
57
describe('FileMetadataComponent', () => {
68
let component: FileMetadataComponent;
79
let fixture: ComponentFixture<FileMetadataComponent>;
810

911
beforeEach(async () => {
1012
await TestBed.configureTestingModule({
11-
imports: [FileMetadataComponent],
13+
imports: [FileMetadataComponent, OSFTestingModule],
1214
}).compileComponents();
1315

1416
fixture = TestBed.createComponent(FileMetadataComponent);

src/app/features/files/components/file-resource-metadata/file-resource-metadata.component.spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
22

33
import { FileResourceMetadataComponent } from './file-resource-metadata.component';
44

5+
import { OSFTestingModule } from '@testing/osf.testing.module';
6+
57
describe('FileResourceMetadataComponent', () => {
68
let component: FileResourceMetadataComponent;
79
let fixture: ComponentFixture<FileResourceMetadataComponent>;
810

911
beforeEach(async () => {
1012
await TestBed.configureTestingModule({
11-
imports: [FileResourceMetadataComponent],
13+
imports: [FileResourceMetadataComponent, OSFTestingModule],
1214
}).compileComponents();
1315

1416
fixture = TestBed.createComponent(FileResourceMetadataComponent);

src/app/features/files/components/file-revisions/file-revisions.component.spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
22

33
import { FileRevisionsComponent } from './file-revisions.component';
44

5+
import { OSFTestingModule } from '@testing/osf.testing.module';
6+
57
describe('FileRevisionsComponent', () => {
68
let component: FileRevisionsComponent;
79
let fixture: ComponentFixture<FileRevisionsComponent>;
810

911
beforeEach(async () => {
1012
await TestBed.configureTestingModule({
11-
imports: [FileRevisionsComponent],
13+
imports: [FileRevisionsComponent, OSFTestingModule],
1214
}).compileComponents();
1315

1416
fixture = TestBed.createComponent(FileRevisionsComponent);

src/app/features/files/pages/file-detail/file-detail.component.spec.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
1-
import { MockComponent, MockProvider } from 'ng-mocks';
1+
import { MockComponent } from 'ng-mocks';
22

33
import { ComponentFixture, TestBed } from '@angular/core/testing';
4-
import { ActivatedRoute } from '@angular/router';
54

65
import { SubHeaderComponent } from '@shared/components';
76

87
import { FileDetailComponent } from './file-detail.component';
98

9+
import { OSFTestingModule } from '@testing/osf.testing.module';
10+
1011
describe('FileDetailComponent', () => {
1112
let component: FileDetailComponent;
1213
let fixture: ComponentFixture<FileDetailComponent>;
1314

1415
beforeEach(async () => {
1516
await TestBed.configureTestingModule({
16-
imports: [FileDetailComponent, MockComponent(SubHeaderComponent)],
17-
providers: [MockProvider(ActivatedRoute)],
17+
imports: [FileDetailComponent, MockComponent(SubHeaderComponent), OSFTestingModule],
18+
providers: [],
1819
}).compileComponents();
1920

2021
fixture = TestBed.createComponent(FileDetailComponent);

src/app/features/project/addons/addons.component.spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
22

33
import { AddonsComponent } from './addons.component';
44

5+
import { OSFTestingModule } from '@testing/osf.testing.module';
6+
57
describe('AddonsComponent', () => {
68
let component: AddonsComponent;
79
let fixture: ComponentFixture<AddonsComponent>;
810

911
beforeEach(async () => {
1012
await TestBed.configureTestingModule({
11-
imports: [AddonsComponent],
13+
imports: [AddonsComponent, OSFTestingModule],
1214
}).compileComponents();
1315

1416
fixture = TestBed.createComponent(AddonsComponent);

src/app/features/project/addons/components/configure-addon/configure-addon.component.spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
22

33
import { ConfigureAddonComponent } from './configure-addon.component';
44

5+
import { OSFTestingModule } from '@testing/osf.testing.module';
6+
57
describe('ConfigureAddonComponent', () => {
68
let component: ConfigureAddonComponent;
79
let fixture: ComponentFixture<ConfigureAddonComponent>;
810

911
beforeEach(async () => {
1012
await TestBed.configureTestingModule({
11-
imports: [ConfigureAddonComponent],
13+
imports: [ConfigureAddonComponent, OSFTestingModule],
1214
}).compileComponents();
1315

1416
fixture = TestBed.createComponent(ConfigureAddonComponent);

src/testing/osf.testing.module.ts

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { Store } from '@ngxs/store';
22

3+
import { TranslateModule, TranslateService } from '@ngx-translate/core';
4+
35
import { of } from 'rxjs';
46

57
import { CommonModule } from '@angular/common';
@@ -10,19 +12,40 @@ import { BrowserModule } from '@angular/platform-browser';
1012
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
1113
import { provideRouter } from '@angular/router';
1214

13-
const storeMock: jest.Mocked<Store> = {
14-
select: jest.fn().mockReturnValue(of([])),
15-
selectSignal: jest.fn().mockReturnValue(of([])),
16-
dispatch: jest.fn().mockReturnValue(of({})),
17-
} as unknown as jest.Mocked<Store>;
15+
import { ToastService } from '@osf/shared/services';
1816

1917
@NgModule({
20-
imports: [NoopAnimationsModule, BrowserModule, CommonModule],
18+
imports: [NoopAnimationsModule, BrowserModule, CommonModule, TranslateModule.forRoot()],
2119
providers: [
2220
provideRouter([]),
2321
provideHttpClient(withInterceptorsFromDi()),
2422
provideHttpClientTesting(),
25-
{ provide: Store, useValue: storeMock },
23+
{
24+
provide: Store,
25+
useValue: {
26+
select: jest.fn().mockReturnValue(of([])),
27+
selectSignal: jest.fn().mockReturnValue(of([])),
28+
dispatch: jest.fn().mockReturnValue(of({})),
29+
} as unknown as jest.Mocked<Store>,
30+
},
31+
{
32+
provide: ToastService,
33+
useValue: {
34+
success: jest.fn(),
35+
error: jest.fn(),
36+
info: jest.fn(),
37+
warning: jest.fn(),
38+
},
39+
},
40+
{
41+
provide: TranslateService,
42+
useValue: {
43+
get: jest.fn().mockImplementation((key) => of(key || '')),
44+
instant: jest.fn().mockImplementation((key) => key || ''),
45+
use: jest.fn(),
46+
onLangChange: of({}),
47+
},
48+
},
2649
],
2750
})
2851
export class OSFTestingModule {}

0 commit comments

Comments
 (0)