This commit is contained in:
2025-12-06 00:17:24 +01:00
parent 78c85a429c
commit 70d5f5689e
54 changed files with 826 additions and 210 deletions

View File

@@ -0,0 +1,40 @@
import { describe, it, expect } from 'vitest';
import { DemoImageServiceAdapter } from '../../../packages/demo-infrastructure/media/DemoImageServiceAdapter';
describe('DemoImageServiceAdapter - driver avatars', () => {
it('returns male default avatar for a demo driver treated as male (odd id suffix)', () => {
// Given a demo driver id that maps to a male profile
const adapter = new DemoImageServiceAdapter();
// When resolving the driver avatar
const src = adapter.getDriverAvatar('driver-1');
// Then it should use the male default avatar asset
expect(src).toBe('/images/avatars/male-default-avatar.jpg');
});
it('returns female default avatar for a demo driver treated as female (even id suffix)', () => {
// Given a demo driver id that maps to a female profile
const adapter = new DemoImageServiceAdapter();
// When resolving the driver avatar
const src = adapter.getDriverAvatar('driver-2');
// Then it should use the female default avatar asset
expect(src).toBe('/images/avatars/female-default-avatar.jpeg');
});
it('falls back to a sensible default avatar when driver id has no numeric suffix', () => {
// Given a demo driver id without a numeric suffix
const adapter = new DemoImageServiceAdapter();
// When resolving the driver avatar
const src = adapter.getDriverAvatar('demo-driver');
// Then it should still resolve to one of the default avatar assets
expect(['/images/avatars/male-default-avatar.jpg', '/images/avatars/female-default-avatar.jpeg']).toContain(
src,
);
});
});