Skip to content

Commit fdb0b71

Browse files
authored
chore: resolve technical debt after v2.0.0 migration (#89)
* chore: resolve technical debt after v2.0.0 migration spec files (10): - Replace TranslateModule.forRoot() with provideTranslateService() in all *.spec.ts files — TranslateModule was removed in ngx-translate v18, causing all unit tests to fail at compile time package.json: - Remove autoprefixer (not referenced in postcss.config.json) - Remove @tailwindcss/aspect-ratio (built into Tailwind v4, already documented as removed in CHANGELOG but still listed in devDependencies) interceptors/retry.interceptor.ts: - Remove debug console.log from production retry logic features-demo.component.ts: - Remove debug console.log from onSelectionChange handler * chore: reorder import statements in retry interceptor
1 parent 555951f commit fdb0b71

13 files changed

Lines changed: 40 additions & 38 deletions

File tree

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,9 @@
8888
"@angular/compiler-cli": "^22.0.1",
8989
"@types/jasmine": "^5.1.4",
9090
"@types/node": "^22.10.2",
91-
"@tailwindcss/aspect-ratio": "^0.4.2",
9291
"@tailwindcss/forms": "^0.5.11",
9392
"@tailwindcss/postcss": "^4.3.3",
9493
"@tailwindcss/typography": "^0.5.20",
95-
"autoprefixer": "^10.4.23",
9694
"husky": "^9.1.7",
9795
"http-server": "^14.1.1",
9896
"jasmine-core": "^5.5.0",

src/app/app.component.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { TestBed } from '@angular/core/testing';
2-
import { AppComponent } from './app.component';
32
import { provideRouter } from '@angular/router';
4-
import { TranslateModule } from '@ngx-translate/core';
3+
import { provideTranslateService } from '@ngx-translate/core';
4+
import { AppComponent } from './app.component';
55

66
describe('AppComponent', () => {
77
beforeEach(async () => {
88
await TestBed.configureTestingModule({
9-
imports: [AppComponent, TranslateModule.forRoot()],
10-
providers: [provideRouter([])],
9+
imports: [AppComponent],
10+
providers: [provideRouter([]), provideTranslateService()],
1111
}).compileComponents();
1212
});
1313

src/app/core/footer/footer.component.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import { ComponentFixture, TestBed } from '@angular/core/testing';
2+
import { provideTranslateService } from '@ngx-translate/core';
23
import { FooterComponent } from './footer.component';
3-
import { TranslateModule } from '@ngx-translate/core';
44

55
describe('FooterComponent', () => {
66
let component: FooterComponent;
77
let fixture: ComponentFixture<FooterComponent>;
88

99
beforeEach(async () => {
1010
await TestBed.configureTestingModule({
11-
imports: [FooterComponent, TranslateModule.forRoot()],
11+
imports: [FooterComponent],
12+
providers: [provideTranslateService()],
1213
}).compileComponents();
1314

1415
fixture = TestBed.createComponent(FooterComponent);

src/app/core/header/header.component.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
import { ComponentFixture, TestBed } from '@angular/core/testing';
2-
import { HeaderComponent } from './header.component';
3-
import { TranslateModule } from '@ngx-translate/core';
42
import { provideRouter } from '@angular/router';
3+
import { provideTranslateService } from '@ngx-translate/core';
4+
import { HeaderComponent } from './header.component';
55

66
describe('HeaderComponent', () => {
77
let component: HeaderComponent;
88
let fixture: ComponentFixture<HeaderComponent>;
99

1010
beforeEach(async () => {
1111
await TestBed.configureTestingModule({
12-
imports: [HeaderComponent, TranslateModule.forRoot()],
13-
providers: [provideRouter([])],
12+
imports: [HeaderComponent],
13+
providers: [provideRouter([]), provideTranslateService()],
1414
}).compileComponents();
1515

1616
fixture = TestBed.createComponent(HeaderComponent);

src/app/core/interceptors/retry.interceptor.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { HttpInterceptorFn, HttpErrorResponse } from '@angular/common/http';
1+
import { HttpErrorResponse, HttpInterceptorFn } from '@angular/common/http';
22
import { retry, timer } from 'rxjs';
33

44
export const retryInterceptor: HttpInterceptorFn = (req, next) => {
@@ -18,7 +18,6 @@ export const retryInterceptor: HttpInterceptorFn = (req, next) => {
1818

1919
// Exponential backoff: 1s, 2s, 4s
2020
const delayMs = Math.pow(2, retryCount - 1) * 1000;
21-
console.log(`Retry attempt ${retryCount} after ${delayMs}ms`);
2221
return timer(delayMs);
2322
},
2423
})

src/app/features/home/components/feature-overview/feature-overview.component.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import { ComponentFixture, TestBed } from '@angular/core/testing';
2+
import { provideTranslateService } from '@ngx-translate/core';
23
import { FeatureOverviewComponent } from './feature-overview.component';
3-
import { TranslateModule } from '@ngx-translate/core';
44

55
describe('FeatureOverviewComponent', () => {
66
let component: FeatureOverviewComponent;
77
let fixture: ComponentFixture<FeatureOverviewComponent>;
88

99
beforeEach(async () => {
1010
await TestBed.configureTestingModule({
11-
imports: [FeatureOverviewComponent, TranslateModule.forRoot()],
11+
imports: [FeatureOverviewComponent],
12+
providers: [provideTranslateService()],
1213
}).compileComponents();
1314

1415
fixture = TestBed.createComponent(FeatureOverviewComponent);

src/app/features/home/components/language-switch/language-switch.component.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import { ComponentFixture, TestBed } from '@angular/core/testing';
2+
import { provideTranslateService } from '@ngx-translate/core';
23
import { LanguageSwitchComponent } from './language-switch.component';
3-
import { TranslateModule } from '@ngx-translate/core';
44

55
describe('LanguageSwitchComponent', () => {
66
let component: LanguageSwitchComponent;
77
let fixture: ComponentFixture<LanguageSwitchComponent>;
88

99
beforeEach(async () => {
1010
await TestBed.configureTestingModule({
11-
imports: [LanguageSwitchComponent, TranslateModule.forRoot()],
11+
imports: [LanguageSwitchComponent],
12+
providers: [provideTranslateService()],
1213
}).compileComponents();
1314

1415
fixture = TestBed.createComponent(LanguageSwitchComponent);

src/app/features/home/components/page-not-found/page-not-found.component.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import { ComponentFixture, TestBed } from '@angular/core/testing';
2+
import { provideTranslateService } from '@ngx-translate/core';
23
import { PageNotFoundComponent } from './page-not-found.component';
3-
import { TranslateModule } from '@ngx-translate/core';
44

55
describe('PageNotFoundComponent', () => {
66
let component: PageNotFoundComponent;
77
let fixture: ComponentFixture<PageNotFoundComponent>;
88

99
beforeEach(async () => {
1010
await TestBed.configureTestingModule({
11-
imports: [PageNotFoundComponent, TranslateModule.forRoot()],
11+
imports: [PageNotFoundComponent],
12+
providers: [provideTranslateService()],
1213
}).compileComponents();
1314

1415
fixture = TestBed.createComponent(PageNotFoundComponent);

src/app/features/home/pages/about/about.component.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import { ComponentFixture, TestBed } from '@angular/core/testing';
2+
import { provideTranslateService } from '@ngx-translate/core';
23
import { AboutComponent } from './about.component';
3-
import { TranslateModule } from '@ngx-translate/core';
44

55
describe('AboutComponent', () => {
66
let component: AboutComponent;
77
let fixture: ComponentFixture<AboutComponent>;
88

99
beforeEach(async () => {
1010
await TestBed.configureTestingModule({
11-
imports: [AboutComponent, TranslateModule.forRoot()],
11+
imports: [AboutComponent],
12+
providers: [provideTranslateService()],
1213
}).compileComponents();
1314

1415
fixture = TestBed.createComponent(AboutComponent);

src/app/features/home/pages/api-demo/api-demo.component.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
import { ComponentFixture, TestBed } from '@angular/core/testing';
21
import { provideHttpClient } from '@angular/common/http';
32
import { provideHttpClientTesting } from '@angular/common/http/testing';
3+
import { ComponentFixture, TestBed } from '@angular/core/testing';
4+
import { provideTranslateService } from '@ngx-translate/core';
45
import { ApiDemoComponent } from './api-demo.component';
5-
import { TranslateModule } from '@ngx-translate/core';
66

77
describe('ApiDemoComponent', () => {
88
let component: ApiDemoComponent;
99
let fixture: ComponentFixture<ApiDemoComponent>;
1010

1111
beforeEach(async () => {
1212
await TestBed.configureTestingModule({
13-
imports: [ApiDemoComponent, TranslateModule.forRoot()],
14-
providers: [provideHttpClient(), provideHttpClientTesting()],
13+
imports: [ApiDemoComponent],
14+
providers: [provideHttpClient(), provideHttpClientTesting(), provideTranslateService()],
1515
}).compileComponents();
1616

1717
fixture = TestBed.createComponent(ApiDemoComponent);

0 commit comments

Comments
 (0)