UNPKG
codetrix
Version:
latest (1.6.0)
1.6.0
1.5.0
1.4.0
1.3.3
1.3.2
1.3.1
1.3.0
1.2.0
1.1.0
1.0.3
1.0.2
1.0.1
1.0.0
A lightweight lodash-style utility library
shivanshujags.github.io/codetrix/
shivanshujags/codetrix
codetrix
/
dist
/
__tests
/
string
/
truncate.test.js
10 lines
(9 loc)
•
299 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
import
{ truncate }
from
"../../string"
;
describe
(
'truncate'
,
() =>
{
it
(
'truncates string with ellipsis'
,
() =>
{
expect
(
truncate
(
'Hello world!'
,
5
)).
toBe
(
'Hello...'
); });
it
(
'returns original if within length'
,
() =>
{
expect
(
truncate
(
'Hi'
,
5
)).
toBe
(
'Hi'
); }); });