import { BlogPost } from '../../blog/entities/BlogPost'; import { StorefrontBlogViewService } from './StorefrontBlogViewService'; describe('StorefrontBlogViewService', () => { let service: StorefrontBlogViewService; beforeEach(() => { service = new StorefrontBlogViewService(); }); it('maps posts to card views with image urls', () => { const views = service.toPostsIndexView([ { id: 'post-1', title: 'Hello', thumbnailStorageKey: 'thumb.webp', bannerStorageKey: null, contentHtml: '', isDraft: false, createdAt: new Date(), updatedAt: new Date() } as BlogPost ]); expect(views).toEqual([ { id: 'post-1', title: 'Hello', thumbnailUrl: '/uploads/public/blog/images/thumb.webp', detailHref: '/shop/blog/post-1' } ]); }); });