Compare commits

...
3 Commits
Author SHA1 Message Date
fraujulianandClaude Opus 5.5 def1897723 docs: describe Vitest test setup
CI / formatting (push) Successful in 58s
CI / lint (push) Successful in 1m18s
CI / metadata (push) Successful in 1m11s
CI / tests (push) Successful in 1m4s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-06 20:45:05 +02:00
fraujulianandClaude Opus 5.5 2764ea0c96 ci: run tests without Chrome
Vitest runs the specs in jsdom, so the Chrome setup step is no longer needed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-06 20:44:53 +02:00
fraujulianandClaude Opus 5.5 ca1cf8aefe test: migrate from Karma and Jasmine to Vitest
Karma is deprecated and depends on braces, which has no patched release for GHSA-vfj7-8cjw-p6xm. Tests now run through the @angular/build unit-test builder with Vitest and jsdom. fakeAsync is replaced by Vitest fake timers, and zone.js is dropped because the zoneless app only loaded it for the Karma test polyfills.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-06 20:44:40 +02:00
10 changed files with 769 additions and 1899 deletions

No files matched your search

+1 -8
View File
@@ -59,12 +59,5 @@ jobs:
with: with:
node-version: '24.15.0' node-version: '24.15.0'
cache: npm cache: npm
- uses: browser-actions/setup-chrome@v2
id: setup-chrome
with:
install-dependencies: true
- run: npm ci - run: npm ci
- name: Run tests - run: npm run test
run: npm run test -- --browsers=ChromeHeadlessNoSandbox
env:
CHROME_BIN: ${{ steps.setup-chrome.outputs.chrome-path }}
+2 -2
View File
@@ -3,7 +3,7 @@
## Project Context ## Project Context
This is an Angular portfolio application using Angular 21, TypeScript, SCSS, This is an Angular portfolio application using Angular 21, TypeScript, SCSS,
Karma/Jasmine tests, and static hosting for production output. Production Vitest tests, and static hosting for production output. Production
application code lives in `src/app`; the client entry point lives in application code lives in `src/app`; the client entry point lives in
`src/main.ts`. `src/main.ts`.
@@ -32,7 +32,7 @@ maintain generated or copied output in `public/assets/optimized` or `dist`.
- `npm run build`: generates assets, builds the production app, and copies - `npm run build`: generates assets, builds the production app, and copies
static root files. Run this only when explicitly requested. static root files. Run this only when explicitly requested.
- `npm start`: serves the built static app through `scripts/static-server.mjs`. - `npm start`: serves the built static app through `scripts/static-server.mjs`.
- `npm test`: generates assets and starts Angular tests with Karma/Jasmine. - `npm test`: generates assets and starts Angular tests with Vitest.
- `npm run check`: runs linting, format checks, version checks, and source text - `npm run check`: runs linting, format checks, version checks, and source text
checks. Always use this as the final validation. checks. Always use this as the final validation.
- `npm run fix`: places version data, runs ESLint fixes, fixes source text, and - `npm run fix`: places version data, runs ESLint fixes, fixes source text, and
+2 -2
View File
@@ -9,7 +9,7 @@ Visit the live website at [fraujulian.xyz](https://fraujulian.xyz/).
- Angular 22 - Angular 22
- TypeScript - TypeScript
- SCSS - SCSS
- Karma and Jasmine for tests - Vitest for tests
## Features ## Features
@@ -59,7 +59,7 @@ built site at `http://localhost:3000`.
npm run test npm run test
``` ```
This generates assets and runs the Karma/Jasmine tests in ChromeHeadless. This generates assets and runs the Vitest tests in jsdom.
## Docs ## Docs
+3 -19
View File
@@ -126,27 +126,11 @@
"builder": "@angular/build:extract-i18n" "builder": "@angular/build:extract-i18n"
}, },
"test": { "test": {
"builder": "@angular/build:karma", "builder": "@angular/build:unit-test",
"options": { "options": {
"watch": false, "buildTarget": "::development",
"browsers": "ChromeHeadless",
"polyfills": ["zone.js", "zone.js/testing"],
"tsConfig": "tsconfig.spec.json", "tsConfig": "tsconfig.spec.json",
"inlineStyleLanguage": "scss", "watch": false
"assets": [
{
"glob": "**/*",
"input": "src/assets/optimized",
"output": "assets/optimized"
},
{
"glob": "**/*",
"input": "public",
"output": "public"
}
],
"styles": ["src/styles.scss"],
"scripts": []
} }
} }
} }
+651 -1766
View File
File diff suppressed because it is too large. Load diff
+4 -10
View File
@@ -70,15 +70,13 @@
"express": "^5.2.1", "express": "^5.2.1",
"markdown-it": "^15.0.2", "markdown-it": "^15.0.2",
"rxjs": "~7.8.0", "rxjs": "~7.8.0",
"tslib": "^2.3.0", "tslib": "^2.3.0"
"zone.js": "~0.16.2"
}, },
"devDependencies": { "devDependencies": {
"@angular/build": "^22.2.1", "@angular/build": "^22.2.1",
"@angular/cli": "^22.2.1", "@angular/cli": "^22.2.1",
"@angular/compiler-cli": "^22.2.1", "@angular/compiler-cli": "^22.2.1",
"@types/express": "^5.0.6", "@types/express": "^5.0.6",
"@types/jasmine": "~6.0.0",
"@types/node": "^25.7.0", "@types/node": "^25.7.0",
"@types/showdown": "^2.0.6", "@types/showdown": "^2.0.6",
"@typescript-eslint/eslint-plugin": "8.71.1", "@typescript-eslint/eslint-plugin": "8.71.1",
@@ -92,17 +90,13 @@
"eslint-plugin-promise": "7.3.0", "eslint-plugin-promise": "7.3.0",
"eslint-plugin-unused-imports": "4.4.1", "eslint-plugin-unused-imports": "4.4.1",
"husky": "^9.1.7", "husky": "^9.1.7",
"jasmine-core": "~6.2.0", "jsdom": "^30.1.2",
"karma": "~6.4.0",
"karma-chrome-launcher": "~3.2.0",
"karma-coverage": "~2.2.0",
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "^2.3.0",
"postcss": "^8.5.29", "postcss": "^8.5.29",
"postcss-selector-parser": "^7.1.1", "postcss-selector-parser": "^7.1.1",
"prettier": "^3.8.1", "prettier": "^3.8.1",
"sharp": "^0.35.5", "sharp": "^0.35.5",
"typescript": "~6.0.3", "typescript": "~6.0.3",
"typescript-eslint": "8.71.1" "typescript-eslint": "8.71.1",
"vitest": "^5.0.3"
} }
} }
+8 -6
View File
@@ -31,7 +31,9 @@ describe('AppComponent', (): void => {
}); });
it('should preselect English by default', (): void => { it('should preselect English by default', (): void => {
const comp = component as unknown as { selectedLanguage(): string }; const comp = component as unknown as {
selectedLanguage(): string;
};
expect(comp.selectedLanguage()).toBe('en'); expect(comp.selectedLanguage()).toBe('en');
}); });
@@ -57,8 +59,8 @@ describe('AppComponent', (): void => {
fixture.detectChanges(); fixture.detectChanges();
expect(comp.currentLanguageCode()).toBe('de'); expect(comp.currentLanguageCode()).toBe('de');
expect(comp.isLanguageConfirmed()).toBeTrue(); expect(comp.isLanguageConfirmed()).toBe(true);
expect(comp.isLanguageSelectorOpen()).toBeFalse(); expect(comp.isLanguageSelectorOpen()).toBe(false);
expect(localStorage.getItem('portfolio-language')).toBe('de'); expect(localStorage.getItem('portfolio-language')).toBe('de');
}); });
@@ -74,8 +76,8 @@ describe('AppComponent', (): void => {
}; };
expect(restoredComponent.currentLanguageCode()).toBe('de'); expect(restoredComponent.currentLanguageCode()).toBe('de');
expect(restoredComponent.isLanguageConfirmed()).toBeTrue(); expect(restoredComponent.isLanguageConfirmed()).toBe(true);
expect(restoredComponent.isLanguageSelectorOpen()).toBeFalse(); expect(restoredComponent.isLanguageSelectorOpen()).toBe(false);
}); });
it('should reopen the selector after confirmation', (): void => { it('should reopen the selector after confirmation', (): void => {
@@ -89,6 +91,6 @@ describe('AppComponent', (): void => {
comp.reopenLanguageSelector(); comp.reopenLanguageSelector();
fixture.detectChanges(); fixture.detectChanges();
expect(comp.isLanguageSelectorOpen()).toBeTrue(); expect(comp.isLanguageSelectorOpen()).toBe(true);
}); });
}); });
+96 -84
View File
@@ -1,5 +1,6 @@
import type { Mock } from 'vitest';
import type { ComponentFixture } from '@angular/core/testing'; import type { ComponentFixture } from '@angular/core/testing';
import { TestBed, fakeAsync, tick, discardPeriodicTasks } from '@angular/core/testing'; import { TestBed } from '@angular/core/testing';
import { provideRouter } from '@angular/router'; import { provideRouter } from '@angular/router';
import { IMAGE_LOADER } from '@angular/common'; import { IMAGE_LOADER } from '@angular/common';
import type { ImageLoaderConfig } from '@angular/common'; import type { ImageLoaderConfig } from '@angular/common';
@@ -14,6 +15,28 @@ import type {
} from '../../languages/language.types'; } from '../../languages/language.types';
describe('HomeComponent', (): void => { describe('HomeComponent', (): void => {
beforeEach((): void => {
// performance stays real so the change detection timing tests keep measuring.
vi.useFakeTimers({
toFake: [
'setTimeout',
'clearTimeout',
'setInterval',
'clearInterval',
'requestAnimationFrame',
'cancelAnimationFrame',
],
});
// jsdom does not implement matchMedia.
vi.stubGlobal('matchMedia', (): MediaQueryList => ({ matches: false }) as MediaQueryList);
});
afterEach((): void => {
vi.restoreAllMocks();
vi.unstubAllGlobals();
vi.useRealTimers();
});
let fixture: ComponentFixture<HomeComponent>; let fixture: ComponentFixture<HomeComponent>;
let component: HomeComponent; let component: HomeComponent;
@@ -63,8 +86,7 @@ describe('HomeComponent', (): void => {
afterEach((): void => { afterEach((): void => {
// Explicitly destroy to stop the interval(1000) subscription started in ngOnInit. // Explicitly destroy to stop the interval(1000) subscription started in ngOnInit.
// Without this, the real setInterval keeps the browser's event loop alive after // Without this, the interval keeps firing after the test has finished.
// the test suite completes, causing Karma to disconnect with a 30 s timeout.
fixture.destroy(); fixture.destroy();
}); });
@@ -151,7 +173,7 @@ describe('HomeComponent', (): void => {
it('should set isPortraitSwitching to true immediately', (): void => { it('should set isPortraitSwitching to true immediately', (): void => {
comp.isPortraitSwitching = false; comp.isPortraitSwitching = false;
comp.showNextPortraitHighlight(); comp.showNextPortraitHighlight();
expect(comp.isPortraitSwitching).toBeTrue(); expect(comp.isPortraitSwitching).toBe(true);
}); });
it('should not advance index when already switching', (): void => { it('should not advance index when already switching', (): void => {
@@ -161,129 +183,124 @@ describe('HomeComponent', (): void => {
}); });
it('should not call setTimeout when only one portrait exists', (): void => { it('should not call setTimeout when only one portrait exists', (): void => {
const highlights = (comp as unknown as { portraitHighlights: LanguagePortraitHighlight[] }) const highlights = (
.portraitHighlights; comp as unknown as {
portraitHighlights: LanguagePortraitHighlight[];
}
).portraitHighlights;
const saved = [...highlights]; // snapshot before mutation const saved = [...highlights]; // snapshot before mutation
highlights.splice(1, saved.length - 1); // reduce to a single entry highlights.splice(1, saved.length - 1); // reduce to a single entry
const setSpy = spyOn(window, 'setTimeout'); const setSpy = vi.spyOn(window, 'setTimeout');
comp.showNextPortraitHighlight(); comp.showNextPortraitHighlight();
expect(setSpy).not.toHaveBeenCalled(); expect(setSpy).not.toHaveBeenCalled();
highlights.splice(0, highlights.length, ...saved); // restore from snapshot highlights.splice(0, highlights.length, ...saved); // restore from snapshot
}); });
it('should advance the portrait index after 125 ms', fakeAsync((): void => { it('should advance the portrait index after 125 ms', async (): Promise<void> => {
const zone = TestBed.inject(NgZone); const zone = TestBed.inject(NgZone);
zone.runOutsideAngular((): void => { zone.runOutsideAngular((): void => {
comp.showNextPortraitHighlight(); comp.showNextPortraitHighlight();
}); });
tick(125); await vi.advanceTimersByTimeAsync(125);
expect(comp.currentPortraitHighlightIndex).toBe(1); expect(comp.currentPortraitHighlightIndex).toBe(1);
tick(125); await vi.advanceTimersByTimeAsync(125);
discardPeriodicTasks(); });
}));
it('should reset isPortraitSwitching to false after 250 ms', fakeAsync((): void => { it('should reset isPortraitSwitching to false after 250 ms', async (): Promise<void> => {
const zone = TestBed.inject(NgZone); const zone = TestBed.inject(NgZone);
zone.runOutsideAngular((): void => { zone.runOutsideAngular((): void => {
comp.showNextPortraitHighlight(); comp.showNextPortraitHighlight();
}); });
tick(250); await vi.advanceTimersByTimeAsync(250);
expect(comp.isPortraitSwitching).toBeFalse(); expect(comp.isPortraitSwitching).toBe(false);
discardPeriodicTasks(); });
}));
it('should wrap portrait index from the last position back to 0', fakeAsync((): void => { it('should wrap portrait index from the last position back to 0', async (): Promise<void> => {
comp.currentPortraitHighlightIndex = enLanguage.portraitHighlights.length - 1; comp.currentPortraitHighlightIndex = enLanguage.portraitHighlights.length - 1;
const zone = TestBed.inject(NgZone); const zone = TestBed.inject(NgZone);
zone.runOutsideAngular((): void => { zone.runOutsideAngular((): void => {
comp.showNextPortraitHighlight(); comp.showNextPortraitHighlight();
}); });
tick(125); await vi.advanceTimersByTimeAsync(125);
expect(comp.currentPortraitHighlightIndex).toBe(0); expect(comp.currentPortraitHighlightIndex).toBe(0);
tick(125); await vi.advanceTimersByTimeAsync(125);
discardPeriodicTasks(); });
}));
}); });
// ── Bio toggle ───────────────────────────────────────────────────────────── // ── Bio toggle ─────────────────────────────────────────────────────────────
describe('toggleBio', (): void => { describe('toggleBio', (): void => {
it('should mount bio immediately on opening', fakeAsync((): void => { it('should mount bio immediately on opening', async (): Promise<void> => {
comp.toggleBio(); comp.toggleBio();
expect(comp.isLongBioMounted).toBeTrue(); expect(comp.isLongBioMounted).toBe(true);
tick(100); await vi.advanceTimersByTimeAsync(100);
discardPeriodicTasks(); });
}));
it('should set isLongBioShown to true after the double-rAF delay', fakeAsync((): void => { it('should set isLongBioShown to true after the double-rAF delay', async (): Promise<void> => {
comp.toggleBio(); comp.toggleBio();
tick(50); // allow both nested requestAnimationFrame calls to execute await vi.advanceTimersByTimeAsync(50); // allow both nested requestAnimationFrame calls to execute
fixture.detectChanges(); fixture.detectChanges();
expect(comp.isLongBioShown).toBeTrue(); expect(comp.isLongBioShown).toBe(true);
discardPeriodicTasks(); });
}));
it('should set isLongBioShown to false immediately on close', fakeAsync((): void => { it('should set isLongBioShown to false immediately on close', async (): Promise<void> => {
// Open first // Open first
comp.toggleBio(); comp.toggleBio();
tick(50); await vi.advanceTimersByTimeAsync(50);
fixture.detectChanges(); fixture.detectChanges();
// Close // Close
comp.toggleBio(); comp.toggleBio();
fixture.detectChanges(); fixture.detectChanges();
expect(comp.isLongBioShown).toBeFalse(); expect(comp.isLongBioShown).toBe(false);
tick(300); await vi.advanceTimersByTimeAsync(300);
discardPeriodicTasks(); });
}));
it('should keep isLongBioMounted true during the 300 ms close animation', fakeAsync((): void => { it('should keep isLongBioMounted true during the 300 ms close animation', async (): Promise<void> => {
comp.toggleBio(); comp.toggleBio();
tick(50); await vi.advanceTimersByTimeAsync(50);
fixture.detectChanges(); fixture.detectChanges();
comp.toggleBio(); comp.toggleBio();
fixture.detectChanges(); fixture.detectChanges();
expect(comp.isLongBioMounted).toBeTrue(); expect(comp.isLongBioMounted).toBe(true);
tick(299); await vi.advanceTimersByTimeAsync(299);
expect(comp.isLongBioMounted).toBeTrue(); expect(comp.isLongBioMounted).toBe(true);
tick(1); await vi.advanceTimersByTimeAsync(1);
fixture.detectChanges(); fixture.detectChanges();
expect(comp.isLongBioMounted).toBeFalse(); expect(comp.isLongBioMounted).toBe(false);
discardPeriodicTasks(); });
}));
it('should cancel pending close timeout when re-opened during animation', fakeAsync((): void => { it('should cancel pending close timeout when re-opened during animation', async (): Promise<void> => {
comp.toggleBio(); comp.toggleBio();
tick(50); await vi.advanceTimersByTimeAsync(50);
fixture.detectChanges(); fixture.detectChanges();
comp.toggleBio(); // start closing comp.toggleBio(); // start closing
tick(150); // halfway through 300 ms await vi.advanceTimersByTimeAsync(150); // halfway through 300 ms
comp.toggleBio(); // re-open before unmount comp.toggleBio(); // re-open before unmount
tick(50); await vi.advanceTimersByTimeAsync(50);
fixture.detectChanges(); fixture.detectChanges();
expect(comp.isLongBioMounted).toBeTrue(); expect(comp.isLongBioMounted).toBe(true);
expect(comp.isLongBioShown).toBeTrue(); expect(comp.isLongBioShown).toBe(true);
tick(500); await vi.advanceTimersByTimeAsync(500);
discardPeriodicTasks(); });
}));
}); });
// ── Scroll helpers ───────────────────────────────────────────────────────── // ── Scroll helpers ─────────────────────────────────────────────────────────
describe('scroll helpers', (): void => { describe('scroll helpers', (): void => {
let scrollSpy: jasmine.Spy; let scrollSpy: Mock;
beforeEach((): void => { beforeEach((): void => {
scrollSpy = spyOn(window, 'scrollTo'); scrollSpy = vi.spyOn(window, 'scrollTo').mockReturnValue(undefined);
}); });
it('should call window.scrollTo when scrolling to the about section', (): void => { it('should call window.scrollTo when scrolling to the about section', (): void => {
@@ -349,20 +366,18 @@ describe('HomeComponent', (): void => {
// ── Lifecycle cleanup ────────────────────────────────────────────────────── // ── Lifecycle cleanup ──────────────────────────────────────────────────────
describe('ngOnDestroy', (): void => { describe('ngOnDestroy', (): void => {
it('should clear pending portrait switch timers on destroy', fakeAsync((): void => { it('should clear pending portrait switch timers on destroy', async (): Promise<void> => {
comp.showNextPortraitHighlight(); comp.showNextPortraitHighlight();
const clearSpy = spyOn(window, 'clearTimeout').and.callThrough(); const clearSpy = vi.spyOn(window, 'clearTimeout');
fixture.destroy(); fixture.destroy();
expect(clearSpy).toHaveBeenCalled(); expect(clearSpy).toHaveBeenCalled();
discardPeriodicTasks(); });
}));
it('should not throw when destroyed', fakeAsync((): void => { it('should not throw when destroyed', async (): Promise<void> => {
expect((): void => fixture.destroy()).not.toThrow(); expect((): void => fixture.destroy()).not.toThrow();
discardPeriodicTasks(); });
}));
}); });
// ── Template rendering ───────────────────────────────────────────────────── // ── Template rendering ─────────────────────────────────────────────────────
@@ -430,7 +445,7 @@ describe('HomeComponent', (): void => {
describe('Performance', (): void => { describe('Performance', (): void => {
it('should keep scroll effects enabled on desktop pointers when motion is allowed', (): void => { it('should keep scroll effects enabled on desktop pointers when motion is allowed', (): void => {
spyOn(window, 'matchMedia').and.callFake( vi.spyOn(window, 'matchMedia').mockImplementation(
(query: string): MediaQueryList => (query: string): MediaQueryList =>
({ ({
matches: matches:
@@ -439,29 +454,29 @@ describe('HomeComponent', (): void => {
}) as MediaQueryList, }) as MediaQueryList,
); );
expect(comp.shouldEnableScrollEffects()).toBeTrue(); expect(comp.shouldEnableScrollEffects()).toBe(true);
}); });
it('should keep scroll effects enabled on coarse touch pointers when motion is allowed', (): void => { it('should keep scroll effects enabled on coarse touch pointers when motion is allowed', (): void => {
spyOn(window, 'matchMedia').and.callFake( vi.spyOn(window, 'matchMedia').mockImplementation(
(query: string): MediaQueryList => (query: string): MediaQueryList =>
({ ({
matches: query === '(hover: none) and (pointer: coarse)', matches: query === '(hover: none) and (pointer: coarse)',
}) as MediaQueryList, }) as MediaQueryList,
); );
expect(comp.shouldEnableScrollEffects()).toBeTrue(); expect(comp.shouldEnableScrollEffects()).toBe(true);
}); });
it('should disable scroll effects when reduced motion is requested', (): void => { it('should disable scroll effects when reduced motion is requested', (): void => {
spyOn(window, 'matchMedia').and.callFake( vi.spyOn(window, 'matchMedia').mockImplementation(
(query: string): MediaQueryList => (query: string): MediaQueryList =>
({ ({
matches: query === '(prefers-reduced-motion: reduce)', matches: query === '(prefers-reduced-motion: reduce)',
}) as MediaQueryList, }) as MediaQueryList,
); );
expect(comp.shouldEnableScrollEffects()).toBeFalse(); expect(comp.shouldEnableScrollEffects()).toBe(false);
}); });
it('should create and run initial change detection within 200 ms', (): void => { it('should create and run initial change detection within 200 ms', (): void => {
@@ -480,13 +495,13 @@ describe('HomeComponent', (): void => {
expect(performance.now() - start).toBeLessThan(100); expect(performance.now() - start).toBeLessThan(100);
}); });
it('should deduplicate rapid schedule calls to a single requestAnimationFrame', fakeAsync((): void => { it('should deduplicate rapid schedule calls to a single requestAnimationFrame', async (): Promise<void> => {
// The RAF registered during beforeEach's ngOnInit lives outside this fakeAsync zone. // The RAF registered during beforeEach's ngOnInit is still pending under fake timers.
// Resetting the ID to null makes the schedule function treat the slot as free. // Resetting the ID to null makes the schedule function treat the slot as free.
comp.scrollAnimationFrameId = null; comp.scrollAnimationFrameId = null;
let rafCallCount = 0; let rafCallCount = 0;
spyOn(window, 'requestAnimationFrame').and.callFake((): number => { vi.spyOn(window, 'requestAnimationFrame').mockImplementation((): number => {
rafCallCount++; rafCallCount++;
return rafCallCount; // returns non-null so subsequent calls deduplicate return rafCallCount; // returns non-null so subsequent calls deduplicate
}); });
@@ -496,14 +511,13 @@ describe('HomeComponent', (): void => {
comp.scheduleNameGradientUpdate(); comp.scheduleNameGradientUpdate();
expect(rafCallCount).toBe(1); expect(rafCallCount).toBe(1);
discardPeriodicTasks(); });
}));
it('should deduplicate project-entry reveal scheduling the same way', fakeAsync((): void => { it('should deduplicate project-entry reveal scheduling the same way', async (): Promise<void> => {
comp.projectEntryAnimationFrameId = null; comp.projectEntryAnimationFrameId = null;
let rafCallCount = 0; let rafCallCount = 0;
spyOn(window, 'requestAnimationFrame').and.callFake((): number => { vi.spyOn(window, 'requestAnimationFrame').mockImplementation((): number => {
rafCallCount++; rafCallCount++;
return rafCallCount; return rafCallCount;
}); });
@@ -513,14 +527,13 @@ describe('HomeComponent', (): void => {
comp.scheduleProjectEntryRevealUpdate(); comp.scheduleProjectEntryRevealUpdate();
expect(rafCallCount).toBe(1); expect(rafCallCount).toBe(1);
discardPeriodicTasks(); });
}));
it('should deduplicate about-section scroll scheduling the same way', fakeAsync((): void => { it('should deduplicate about-section scroll scheduling the same way', async (): Promise<void> => {
comp.aboutSectionAnimationFrameId = null; comp.aboutSectionAnimationFrameId = null;
let rafCallCount = 0; let rafCallCount = 0;
spyOn(window, 'requestAnimationFrame').and.callFake((): number => { vi.spyOn(window, 'requestAnimationFrame').mockImplementation((): number => {
rafCallCount++; rafCallCount++;
return rafCallCount; return rafCallCount;
}); });
@@ -530,7 +543,6 @@ describe('HomeComponent', (): void => {
comp.scheduleAboutSectionScrollAnimationUpdate(); comp.scheduleAboutSectionScrollAnimationUpdate();
expect(rafCallCount).toBe(1); expect(rafCallCount).toBe(1);
discardPeriodicTasks(); });
}));
}); });
}); });
+1 -1
View File
@@ -133,7 +133,7 @@ describe('ImprintComponent', (): void => {
it('should render an "Imprint & Privacy" heading', (): void => { it('should render an "Imprint & Privacy" heading', (): void => {
const el = fixture.nativeElement as HTMLElement; const el = fixture.nativeElement as HTMLElement;
const headings = Array.from(el.querySelectorAll('h1')); const headings = Array.from(el.querySelectorAll('h1'));
expect(headings.some((h): boolean => h.textContent?.includes('Imprint') === true)).toBeTrue(); expect(headings.some((h): boolean => h.textContent?.includes('Imprint') === true)).toBe(true);
}); });
it('should contain a back link to the portfolio root', (): void => { it('should contain a back link to the portfolio root', (): void => {
+1 -1
View File
@@ -2,7 +2,7 @@
"extends": "./tsconfig.json", "extends": "./tsconfig.json",
"compilerOptions": { "compilerOptions": {
"outDir": "./dist/out-tsc/spec", "outDir": "./dist/out-tsc/spec",
"types": ["jasmine", "node"] "types": ["vitest/globals", "node"]
}, },
"include": ["src/**/*.spec.ts", "src/**/*.d.ts"] "include": ["src/**/*.spec.ts", "src/**/*.d.ts"]
} }