feat: add truncate filter to summary tag (#6105)
Co-authored-by: Till Schweneker <till.schweneker@meltingelements.com> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
@ -1,12 +1,13 @@
|
||||
import { fromJS } from 'immutable';
|
||||
|
||||
import {
|
||||
keyToPathArray,
|
||||
compileStringTemplate,
|
||||
parseDateFromEntry,
|
||||
extractTemplateVars,
|
||||
expandPath,
|
||||
extractTemplateVars,
|
||||
keyToPathArray,
|
||||
parseDateFromEntry,
|
||||
} from '../stringTemplate';
|
||||
|
||||
describe('stringTemplate', () => {
|
||||
describe('keyToPathArray', () => {
|
||||
it('should return array of length 1 with simple path', () => {
|
||||
@ -152,6 +153,28 @@ describe('stringTemplate', () => {
|
||||
),
|
||||
).toBe('BACKENDSLUG-star️-open️');
|
||||
});
|
||||
|
||||
it('return apply filter for truncate', () => {
|
||||
expect(
|
||||
compileStringTemplate(
|
||||
'{{slug | truncate(6)}}',
|
||||
date,
|
||||
'backendSlug',
|
||||
fromJS({ slug: 'entrySlug', starred: true, done: false }),
|
||||
),
|
||||
).toBe('backen...');
|
||||
});
|
||||
|
||||
it('return apply filter for truncate', () => {
|
||||
expect(
|
||||
compileStringTemplate(
|
||||
"{{slug | truncate(3,'***')}}",
|
||||
date,
|
||||
'backendSlug',
|
||||
fromJS({ slug: 'entrySlug', starred: true, done: false }),
|
||||
),
|
||||
).toBe('bac***');
|
||||
});
|
||||
});
|
||||
|
||||
describe('expandPath', () => {
|
||||
|
Reference in New Issue
Block a user