import formatName from './formatName';

// Test cases
test('Should return the author name with surname initial if present', () => {
  const author = { name: 'John Doe' };
  expect(formatName(author)).toBe('John D.');
});

test('Should return the author name without surname initial if only one name present', () => {
  const author = { name: 'John' };
  expect(formatName(author)).toBe('John');
});

test('Should return an empty string if the author name is empty', () => {
  const author = { name: '' };
  expect(formatName(author)).toBe('');
});

test('Should return an empty string if the author name contains only spaces', () => {
  const author = { name: '   ' };
  expect(formatName(author)).toBe('');
});
