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.
 
 
 
 
 
 

18 lines
539 B

import { truncate } from '@/plugins/filters.js'
describe('Truncate', () => {
test('dont do nothing', () => {
const string = 'aiueo'
expect(truncate(string)).toEqual(string)
})
test('cut the string and add clamp if string length is larger than specified length', () => {
const string = 'aiueo'
expect(truncate(string, 3)).toEqual('aiu...')
})
test('dont cut anything if string length is smaller than specified length', () => {
const string = 'aiueo'
expect(truncate(string, 10)).toEqual(string)
})
})