Start tests

This commit is contained in:
2021-11-26 14:31:59 -06:00
parent d251f8bc15
commit bd7d6a2dbd
7 changed files with 857 additions and 5 deletions

View File

@@ -0,0 +1,75 @@
import { padLeft, padRight, padCenter, stringToPascal } from '../../../lib'
import { expect } from 'chai'
describe('util -> support -> string -> padLeft', () => {
it('should return the original string greater than the min', () => {
expect(padLeft('a longer string', 5))
.to.be.equal('a longer string')
})
it('should add spaces to the left of the string', () => {
expect(padLeft('string', 10))
.to.be.equal(' string')
})
it('should respect the pad parameter', () => {
expect(padLeft('string', 10, '*'))
.to.be.equal('****string')
})
})
describe('util -> support -> string -> padRight', () => {
it('should return the original string greater than the min', () => {
expect(padRight('a longer string', 5))
.to.be.equal('a longer string')
})
it('should add spaces to the right of the string', () => {
expect(padRight('string', 10))
.to.be.equal('string ')
})
it('should respect the pad parameter', () => {
expect(padRight('string', 10, '*'))
.to.be.equal('string****')
})
})
describe('util -> support -> string -> padCenter', () => {
it('should return the original string greater than the min', () => {
expect(padCenter('a longer string', 5))
.to.be.equal('a longer string')
})
it('should add spaces to both sides of the string', () => {
expect(padCenter('string', 10))
.to.be.equal(' string ')
})
it('should respect the pad parameter', () => {
expect(padCenter('string', 10, '*'))
.to.be.equal('**string**')
})
})
describe('util -> support -> string -> stringToPascal', () => {
it('should split inputs on spaces', () => {
expect(stringToPascal('foo bar baz'))
.to.be.equal('FooBarBaz')
})
it('should split inputs on underscores', () => {
expect(stringToPascal('foo_bar_baz'))
.to.be.equal('FooBarBaz')
})
it('should split inputs on dashes', () => {
expect(stringToPascal('foo-bar-baz'))
.to.be.equal('FooBarBaz')
})
it('should work with all delimiters', () => {
expect(stringToPascal('foo_bar-baz bin'))
.to.be.equal('FooBarBazBin')
})
})