Skip to content

Commit

Permalink
Verify that AI translation variant is always created with 'includedIn…
Browse files Browse the repository at this point in the history
…LocalizedFile' set to false
  • Loading branch information
maallen committed Nov 6, 2024
1 parent bf6ee32 commit c37c521
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,9 @@ public void testTranslateSuccess() throws Exception {
List<AITranslation> aiTranslations = aiTranslationCaptor.getValue();
assertEquals(3, aiTranslations.size());
assertThat(aiTranslations).extracting("localeId").containsExactlyInAnyOrder(2L, 3L, 4L);
assertThat(aiTranslations)
.extracting("includedInLocalizedFile")
.containsExactlyInAnyOrder(false, false, false);
}

@Test
Expand Down Expand Up @@ -247,6 +250,9 @@ public void testTranslateReuseSource() throws Exception {
assertThat(aiTranslations)
.extracting("translation")
.containsExactlyInAnyOrder("content", "translated", "translated");
assertThat(aiTranslations)
.extracting("includedInLocalizedFile")
.containsExactlyInAnyOrder(false, false, false);
}

@Test
Expand All @@ -265,6 +271,9 @@ public void testNoTranslationIfLeveragedVariantExistsForLocale() {
List<AITranslation> aiTranslations = aiTranslationCaptor.getValue();
assertEquals(2, aiTranslations.size());
assertThat(aiTranslations).extracting("localeId").containsExactlyInAnyOrder(2L, 4L);
assertThat(aiTranslations)
.extracting("includedInLocalizedFile")
.containsExactlyInAnyOrder(false, false);
}

@Test
Expand Down Expand Up @@ -368,6 +377,9 @@ public void testBatchLogic() throws JobExecutionException {
aiTranslations = aiTranslationCaptor.getAllValues().get(i);
assertEquals(3, aiTranslations.size());
assertThat(aiTranslations).extracting("localeId").containsExactlyInAnyOrder(2L, 3L, 4L);
assertThat(aiTranslations)
.extracting("includedInLocalizedFile")
.containsExactlyInAnyOrder(false, false, false);
}
verify(aiTranslationService, times(3)).deleteBatch(isA(Queue.class));
}
Expand Down Expand Up @@ -403,6 +415,9 @@ public void testBatchRequestFailLogic() throws JobExecutionException {
aiTranslations = aiTranslationCaptor.getAllValues().get(i);
assertEquals(3, aiTranslations.size());
assertThat(aiTranslations).extracting("localeId").containsExactlyInAnyOrder(2L, 3L, 4L);
assertThat(aiTranslations)
.extracting("includedInLocalizedFile")
.containsExactlyInAnyOrder(false, false, false);
}
verify(aiTranslationService, times(3)).deleteBatch(isA(Queue.class));
}
Expand Down Expand Up @@ -437,6 +452,9 @@ public void testBatchLogicFailureToRetrieveTextUnit() throws JobExecutionExcepti
aiTranslations = aiTranslationCaptor.getAllValues().get(i);
assertEquals(3, aiTranslations.size());
assertThat(aiTranslations).extracting("localeId").containsExactlyInAnyOrder(2L, 3L, 4L);
assertThat(aiTranslations)
.extracting("includedInLocalizedFile")
.containsExactlyInAnyOrder(false, false, false);
}
verify(aiTranslationService, times(2)).deleteBatch(isA(Queue.class));
}
Expand Down

0 comments on commit c37c521

Please sign in to comment.