fix(api): handle Author sort name generation above field length (#2276)

This commit is contained in:
James Ward
2026-08-07 16:55:57 -04:00
committed by GitHub
parent 7644e771a0
commit c71893c669
3 changed files with 25 additions and 4 deletions
@@ -59,4 +59,21 @@ class AuthorEntityTest {
assertThat(author.getSortName()).isEqualTo("Orwell, George");
}
@Test
void authorSortNameTruncation() {
AuthorEntity author = AuthorEntity.builder()
.name(
"George Orwell Orwell Orwell Orwell Orwell Orwell Orwell Orwell Orwell" +
"Orwell Orwell Orwell Orwell Orwell Orwell Orwell Orwell Orwell Orwell" +
"Orwell Orwell Orwell Orwell Orwell Orwell Orwell Orwell Orwell Orwell" +
"Orwell Orwell Orwell Orwell Orwell Orwell Orwell Orwell Orwell Orwell"
)
.build();
author.computeSortName();
assertThat(author.getSortName()).isNotNull();
assertThat(author.getSortName()).hasSizeLessThan(256);
}
}