refactor(editor): Use typed-mocks to speed up tests and type-checking (no-changelog) (#9796)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2024-06-19 07:41:27 +02:00
committed by GitHub
parent 41e06be6fd
commit e3e20b48eb
28 changed files with 444 additions and 8684 deletions

View File

@@ -0,0 +1,61 @@
import { splitName } from '@/utils/projects.utils';
describe('splitName', () => {
test.each([
[
'First Last <email@domain.com>',
{
firstName: 'First',
lastName: 'Last',
email: 'email@domain.com',
},
],
[
'First Last Third <email@domain.com>',
{
firstName: 'First Last',
lastName: 'Third',
email: 'email@domain.com',
},
],
[
'First Last Third Fourth <email@domain.com>',
{
firstName: 'First Last Third',
lastName: 'Fourth',
email: 'email@domain.com',
},
],
[
'<email@domain.com>',
{
firstName: undefined,
lastName: undefined,
email: 'email@domain.com',
},
],
[
' <email@domain.com>',
{
firstName: '',
lastName: '',
email: 'email@domain.com',
},
],
[
'My project',
{
firstName: 'My',
lastName: 'project',
},
],
[
'MyProject',
{
firstName: 'MyProject',
},
],
])('should split a name in the format "First Last <email@domain.com>"', (input, result) => {
expect(splitName(input)).toEqual(result);
});
});