index.test.js 437 Bytes
Newer Older
1
import { getStrFullLength, cutStrByFullLength } from './index';
2 3

describe('test calculateShowLength', () => {
twisger's avatar
twisger committed
4 5
  it('get full length', () => {
    expect(getStrFullLength('一二,a,')).toEqual(8);
6
  });
twisger's avatar
twisger committed
7 8
  it('cut str by full length', () => {
    expect(cutStrByFullLength('一二,a,', 7)).toEqual('一二,a');
9 10
  });
  it('cut str when length small', () => {
twisger's avatar
twisger committed
11
    expect(cutStrByFullLength('一22三', 5)).toEqual('一22');
12 13
  });
});