index.test.js 440 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13
import { getStrShowLength, cutStrByShowLength } from './index.js';

describe('test calculateShowLength', () => {
  it('get show length', () => {
    expect(getStrShowLength('一二,a,')).toEqual(8);
  });
  it('cut str by show length', () => {
    expect(cutStrByShowLength('一二,a,', 7)).toEqual('一二,a');
  });
  it('cut str when length small', () => {
    expect(cutStrByShowLength('一22三', 5)).toEqual('一22');
  });
});