From 0fca6512c3d9f86bde136e88468bf4007944b249 Mon Sep 17 00:00:00 2001 From: Brian Pilati Date: Mon, 11 Aug 2025 10:27:17 -0500 Subject: [PATCH 1/3] feat(test-fixes): fixed a test --- .../request-access/request-access.component.spec.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/app/core/components/request-access/request-access.component.spec.ts b/src/app/core/components/request-access/request-access.component.spec.ts index bf2e5594d..dd191e221 100644 --- a/src/app/core/components/request-access/request-access.component.spec.ts +++ b/src/app/core/components/request-access/request-access.component.spec.ts @@ -1,3 +1,5 @@ +import { Store } from '@ngxs/store'; + import { TranslatePipe } from '@ngx-translate/core'; import { MockPipe, MockProvider } from 'ng-mocks'; @@ -12,10 +14,17 @@ import { ToastService } from '@osf/shared/services'; import { RequestAccessComponent } from './request-access.component'; -describe('RequestAccessComponent', () => { +describe.only('RequestAccessComponent', () => { let component: RequestAccessComponent; let fixture: ComponentFixture; + const mockStore: jest.Mocked = { + 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)], @@ -27,6 +36,8 @@ describe('RequestAccessComponent', () => { ], }).compileComponents(); + TestBed.overrideProvider(Store, { useValue: mockStore }); + fixture = TestBed.createComponent(RequestAccessComponent); component = fixture.componentInstance; fixture.detectChanges(); From 83bf3dfe55a437def4f36206514f87fbf19ad42f Mon Sep 17 00:00:00 2001 From: Brian Pilati Date: Mon, 11 Aug 2025 10:40:57 -0500 Subject: [PATCH 2/3] feat(enabled): Added a new --- .husky/pre-push | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.husky/pre-push b/.husky/pre-push index 7daf40085..2921f385c 100644 --- a/.husky/pre-push +++ b/.husky/pre-push @@ -1,11 +1,11 @@ # npm run build -# npm run test:coverage || { -# printf "\n\nERROR: Testing errors or coverage issues were found. Please address them before proceeding.\n\n\n\n" -# exit 1 -# } +npm run test:coverage || { + printf "\n\nERROR: Testing errors or coverage issues were found. Please address them before proceeding.\n\n\n\n" + exit 1 +} -# npm run test:check-coverage-thresholds || { -# printf "\n\nERROR: Coverage thresholds were not met. Please address them before proceeding.\n\n\n\n" -# exit 1 -# } \ No newline at end of file +npm run test:check-coverage-thresholds || { + printf "\n\nERROR: Coverage thresholds were not met. Please address them before proceeding.\n\n\n\n" + exit 1 +} \ No newline at end of file From 2a33d4c6e4012602ac4e34a9ecd40b13ee37a876 Mon Sep 17 00:00:00 2001 From: Brian Pilati Date: Mon, 11 Aug 2025 10:45:19 -0500 Subject: [PATCH 3/3] feat(jest-update): Fixed the thresholds --- jest.config.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/jest.config.js b/jest.config.js index 75b567517..28cf1176e 100644 --- a/jest.config.js +++ b/jest.config.js @@ -40,10 +40,10 @@ module.exports = { extensionsToTreatAsEsm: ['.ts'], coverageThreshold: { global: { - branches: 11.2, - functions: 11.34, - lines: 36.73, - statements: 37.33, + branches: 13.84, + functions: 14.33, + lines: 40.35, + statements: 40.9, }, }, testPathIgnorePatterns: [