Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ void onSessionEnded_publishesGenerateFeedback() {
assertThat(summary.analyzedMessageCount()).isEqualTo(2);
assertThat(summary.averageSpeakingRateWpm()).isEqualTo(150.0);
assertThat(summary.totalSilenceDurationSec()).isEqualTo(3.5);
assertThat(summary.fillerWordCounts()).containsExactlyEntriesOf(java.util.Map.of(
assertThat(summary.fillerWordCounts()).containsAllEntriesOf(java.util.Map.of(
"like", 1,
"uh", 1,
"um", 5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.stackup.stackup.session.domain.TtsStatus;
import com.stackup.stackup.user.domain.User;
import java.util.Optional;
import java.util.function.Predicate;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
Expand Down Expand Up @@ -58,9 +59,9 @@ void apply_successStoresTtsFieldsWithoutChangingMessageStatus() {
assertThat(question.getTtsAudioPath()).isEqualTo("interview/tts/50/100.mp3");
assertThat(question.getTtsDurationSec()).isEqualTo(2.4);
assertThat(MessageResult.of(question).ttsAudioPath()).isEqualTo("interview/tts/50/100.mp3");
verify(events).publishEvent(argThat(event ->
verify(events).publishEvent(argThatObject(event ->
isNotice(event, RealtimeNotifyEvent.Channel.SESSION, 50L)));
verify(events).publishEvent(argThat(event ->
verify(events).publishEvent(argThatObject(event ->
isNotice(event, RealtimeNotifyEvent.Channel.USER, 1L)));
verify(processedMessageRepository).save(any(ProcessedMessage.class));
}
Expand All @@ -81,7 +82,7 @@ void apply_failedMarksOnlyTtsFailedAndLeavesQuestionUsable() {
assertThat(question.getTtsStatus()).isEqualTo(TtsStatus.FAILED);
assertThat(question.getContent()).isEqualTo("Q?");
assertThat(question.getTtsAudioPath()).isNull();
verify(events).publishEvent(argThat(event ->
verify(events).publishEvent(argThatObject(event ->
isNotice(event, RealtimeNotifyEvent.Channel.SESSION, 50L)));
verify(processedMessageRepository).save(any(ProcessedMessage.class));
}
Expand Down Expand Up @@ -145,6 +146,10 @@ private boolean isNotice(Object event, RealtimeNotifyEvent.Channel channel, Long
&& realtimeNotifyEvent.type() == SseEventType.SESSION_MESSAGE;
}

private Object argThatObject(Predicate<Object> predicate) {
return argThat(predicate::test);
}

private InterviewSession sessionFixture(Long id) {
User user = User.createGithubUser(1L, "u", null, null, "t");
ReflectionTestUtils.setField(user, "id", 1L);
Expand Down