Skip to content

Commit 96a20a9

Browse files
authored
Merge pull request #240 from bp-cos/feature/fixed-a-test
feat(test-fixes): fixed a test
2 parents 48d0c39 + 2a33d4c commit 96a20a9

File tree

3 files changed

+24
-13
lines changed

3 files changed

+24
-13
lines changed

.husky/pre-push

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# npm run build
22

3-
# npm run test:coverage || {
4-
# printf "\n\nERROR: Testing errors or coverage issues were found. Please address them before proceeding.\n\n\n\n"
5-
# exit 1
6-
# }
3+
npm run test:coverage || {
4+
printf "\n\nERROR: Testing errors or coverage issues were found. Please address them before proceeding.\n\n\n\n"
5+
exit 1
6+
}
77

8-
# npm run test:check-coverage-thresholds || {
9-
# printf "\n\nERROR: Coverage thresholds were not met. Please address them before proceeding.\n\n\n\n"
10-
# exit 1
11-
# }
8+
npm run test:check-coverage-thresholds || {
9+
printf "\n\nERROR: Coverage thresholds were not met. Please address them before proceeding.\n\n\n\n"
10+
exit 1
11+
}

jest.config.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ module.exports = {
4040
extensionsToTreatAsEsm: ['.ts'],
4141
coverageThreshold: {
4242
global: {
43-
branches: 11.2,
44-
functions: 11.34,
45-
lines: 36.73,
46-
statements: 37.33,
43+
branches: 13.84,
44+
functions: 14.33,
45+
lines: 40.35,
46+
statements: 40.9,
4747
},
4848
},
4949
testPathIgnorePatterns: [

src/app/core/components/request-access/request-access.component.spec.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { Store } from '@ngxs/store';
2+
13
import { TranslatePipe } from '@ngx-translate/core';
24
import { MockPipe, MockProvider } from 'ng-mocks';
35

@@ -12,10 +14,17 @@ import { ToastService } from '@osf/shared/services';
1214

1315
import { RequestAccessComponent } from './request-access.component';
1416

15-
describe('RequestAccessComponent', () => {
17+
describe.only('RequestAccessComponent', () => {
1618
let component: RequestAccessComponent;
1719
let fixture: ComponentFixture<RequestAccessComponent>;
1820

21+
const mockStore: jest.Mocked<Store> = {
22+
dispatch: jest.fn().mockResolvedValue(undefined) as any,
23+
select: jest.fn().mockReturnValue(of(undefined)) as any,
24+
selectSnapshot: jest.fn() as any,
25+
reset: jest.fn() as any,
26+
} as any;
27+
1928
beforeEach(async () => {
2029
await TestBed.configureTestingModule({
2130
imports: [RequestAccessComponent, MockPipe(TranslatePipe)],
@@ -27,6 +36,8 @@ describe('RequestAccessComponent', () => {
2736
],
2837
}).compileComponents();
2938

39+
TestBed.overrideProvider(Store, { useValue: mockStore });
40+
3041
fixture = TestBed.createComponent(RequestAccessComponent);
3142
component = fixture.componentInstance;
3243
fixture.detectChanges();

0 commit comments

Comments
 (0)