summaryrefslogtreecommitdiff
path: root/node_modules/typographic-ellipses/test.js
blob: f03433e7949405645e8f77193e0f3530d100f403 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import ellipses from './index';
import { equal, notEqual } from 'assert';

it('should fix single cases', ()=> {
  equal(ellipses('foo...bar'), 'foo…bar');
});

it('should fix multiple cases', ()=> {
  equal(ellipses('foo...bar...moo'), 'foo…bar…moo');
});

it('should fix multiline strings too', ()=> {
  equal(ellipses('multiline\n test...'), 'multiline\n test…');
});

it('should not fix two periods', ()=> {
  equal(ellipses('foo..bar'), 'foo..bar');
});

it('should not replace all the things', ()=> {
  notEqual(ellipses('foo'), '…');
});