mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-05 00:01:37 +08:00

* chore: Switch to Node 20 + Vitest * chore: migrate to vitest mock functions * chore: code style (switch to prettier) * test: re-enable long-running test Seems the switch to Node 20 and Vitest has vastly improved the code's and / or the test's runtime! see #1193 * chore: code style * chore: fix failing tests * Updated Documentation in README.md * Update contribution guidelines to state usage of Prettier * fix: set prettier printWidth back to 80 * chore: apply updated code style automatically * fix: set prettier line endings to lf again * chore: apply updated code style automatically --------- Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com>
48 lines
1.9 KiB
JavaScript
48 lines
1.9 KiB
JavaScript
import { upperCaseConversion } from '../UpperCaseConversion'
|
|
|
|
describe('Test the upperCaseConversion function', () => {
|
|
it('should return an empty string when the input is an empty string', () => {
|
|
expect(upperCaseConversion('')).toEqual('')
|
|
})
|
|
|
|
it('should return an all-uppercase string when input is an all-uppercase string', () => {
|
|
expect(upperCaseConversion('ALLUPPERCASE')).toEqual('ALLUPPERCASE')
|
|
})
|
|
|
|
it('should return an all-uppercase string when input is an all-uppercase string with spaces', () => {
|
|
expect(upperCaseConversion('ALL UPPERCASE')).toEqual('ALL UPPERCASE')
|
|
})
|
|
|
|
it('should return an all-uppercase string when input is an all-uppercase string with punctuation', () => {
|
|
expect(upperCaseConversion('ALL UPPER-CASE!')).toEqual('ALL UPPER-CASE!')
|
|
})
|
|
|
|
it('should return an all-uppercase string when input is an all-lowercase string', () => {
|
|
expect(upperCaseConversion('lowercaseinput')).toEqual('LOWERCASEINPUT')
|
|
})
|
|
|
|
it('should return an all-uppercase string when input is an all-lowercase string with spaces', () => {
|
|
expect(upperCaseConversion('lowercase input')).toEqual('LOWERCASE INPUT')
|
|
})
|
|
|
|
it('should return an all-uppercase string when input is an all-lowercase string with punctuation', () => {
|
|
expect(upperCaseConversion('lower-case, input.')).toEqual(
|
|
'LOWER-CASE, INPUT.'
|
|
)
|
|
})
|
|
|
|
it('should return an all-uppercase string when input is an mixed-case string', () => {
|
|
expect(upperCaseConversion('mixeDCaSeINPuT')).toEqual('MIXEDCASEINPUT')
|
|
})
|
|
|
|
it('should return an all-uppercase string when input is an mixed-case string with spaces', () => {
|
|
expect(upperCaseConversion('mixeD CaSe INPuT')).toEqual('MIXED CASE INPUT')
|
|
})
|
|
|
|
it('should return an all-uppercase string when input is an mixed-case string with punctuation', () => {
|
|
expect(upperCaseConversion('mixeD-CaSe INPuT!')).toEqual(
|
|
'MIXED-CASE INPUT!'
|
|
)
|
|
})
|
|
})
|