Fix: multi-select default values validation (#12271)
https://github.com/user-attachments/assets/3bea63cc-b098-4252-8787-fc6263f01e8d Closes #12277 --------- Co-authored-by: prastoin <paul@twenty.com> Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@ -0,0 +1,68 @@
|
||||
import { EachTestingContext } from 'twenty-shared/testing';
|
||||
|
||||
import { trimAndRemoveDuplicatedWhitespacesFromString } from 'src/utils/trim-and-remove-duplicated-whitespaces-from-string';
|
||||
|
||||
type TrimAndRemoveWhitespacesTestCase = EachTestingContext<{
|
||||
input: string;
|
||||
expected: string;
|
||||
}>;
|
||||
|
||||
describe('trim-and-remove-duplicated-whitespaces-from-string', () => {
|
||||
const testCases: TrimAndRemoveWhitespacesTestCase[] = [
|
||||
{
|
||||
title: 'should trim and remove duplicated whitespaces from a string',
|
||||
context: {
|
||||
input: ' Hello World ',
|
||||
expected: 'Hello World',
|
||||
},
|
||||
},
|
||||
{
|
||||
title: 'should handle string with multiple spaces between words',
|
||||
context: {
|
||||
input: 'This is a test',
|
||||
expected: 'This is a test',
|
||||
},
|
||||
},
|
||||
{
|
||||
title: 'should handle string with only whitespaces',
|
||||
context: {
|
||||
input: ' ',
|
||||
expected: '',
|
||||
},
|
||||
},
|
||||
{
|
||||
title: 'should handle empty string',
|
||||
context: {
|
||||
input: '',
|
||||
expected: '',
|
||||
},
|
||||
},
|
||||
{
|
||||
title: 'should handle string with tabs and newlines',
|
||||
context: {
|
||||
input: 'Hello\t\t\tWorld\n\n Test',
|
||||
expected: 'Hello World Test',
|
||||
},
|
||||
},
|
||||
{
|
||||
title: 'should handle string with leading and trailing spaces',
|
||||
context: {
|
||||
input: ' Leading and trailing spaces ',
|
||||
expected: 'Leading and trailing spaces',
|
||||
},
|
||||
},
|
||||
{
|
||||
title: 'should preserve single spaces between words',
|
||||
context: {
|
||||
input: 'This is already properly spaced',
|
||||
expected: 'This is already properly spaced',
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
test.each(testCases)('$title', ({ context: { input, expected } }) => {
|
||||
const result = trimAndRemoveDuplicatedWhitespacesFromString(input);
|
||||
|
||||
expect(result).toEqual(expected);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user