@shopgate/pwa-common-commerce
Version:
Commerce library for the Shopgate Connect PWA.
1 lines • 726 B
JavaScript
import removeHighlightingPlaceholders from"./removeHighlightingPlaceholders";describe('search/helpers',function(){describe('removeHighlightingPlaceholers test',function(){it('should not change string without placeholders',function(){var result=removeHighlightingPlaceholders(['foo','bar']);expect(result[0]).toBe('foo');});it('should remove $start$ and $end$',function(){var testArray=['$start$foo$end$','$start$$end$','$end$$start$','$start$foo$end$'];var result=removeHighlightingPlaceholders(testArray);result.forEach(function(item,key){expect(item.indexOf('start')).toBe(-1);expect(item.indexOf('end')).toBe(-1);expect(item.indexOf('$')).toBe(-1);expect(item.length).toBe(Math.max(testArray[key].length-12,0));});});});});