The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/apps/meteor/tests/unit/lib/utils/stringUtils.tests.ts

21 lines
623 B

import { expect } from 'chai';
import { truncate } from '../../../../lib/utils/stringUtils';
describe('String utils', () => {
it('should return an empty string when the specified string is empty', () => {
expect(truncate('', 10)).to.be.equal('');
});
it('should truncate a larger string', () => {
expect(truncate('this text has a few words', 9)).to.be.equal('this t...');
});
it('should not truncate a smaller string', () => {
expect(truncate('this', 9)).to.be.equal('this');
});
it('should not truncate a string with the exact length', () => {
expect(truncate('this', 4)).to.be.equal('this');
});
});