Wire blogEnabled into shop render locals and expose public blog index and detail routes when the shop toggle is on.
35 lines
1.0 KiB
TypeScript
35 lines
1.0 KiB
TypeScript
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'
|
|
}
|
|
]);
|
|
});
|
|
});
|