added more logging around $YESNO so we can get more consistent yes and no replies processed.... they are spotty currently
This commit is contained in:
@@ -1,13 +1,44 @@
|
||||
using System.Text.Json;
|
||||
using Jibo.Cloud.Application.Abstractions;
|
||||
using Jibo.Cloud.Application.Services;
|
||||
using Jibo.Cloud.Domain.Models;
|
||||
using Jibo.Cloud.Infrastructure.Telemetry;
|
||||
using Jibo.Runtime.Abstractions;
|
||||
using Microsoft.Extensions.Logging.Abstractions;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Moq;
|
||||
|
||||
namespace Jibo.Cloud.Tests.Turn;
|
||||
|
||||
public sealed class FileTurnTelemetrySinkTests
|
||||
{
|
||||
[Fact]
|
||||
public async Task RecordsTurnDiagnosticSnapshot()
|
||||
{
|
||||
var directoryPath = Path.Combine(Path.GetTempPath(), "OpenJibo.Tests", Guid.NewGuid().ToString("N"));
|
||||
var sink = new FileTurnTelemetrySink(
|
||||
NullLogger<FileTurnTelemetrySink>.Instance,
|
||||
Options.Create(new TurnTelemetryOptions
|
||||
{
|
||||
Enabled = true,
|
||||
DirectoryPath = directoryPath
|
||||
}));
|
||||
|
||||
await sink.RecordTurnDiagnosticAsync("yes_no_turn_received", new Dictionary<string, object?>
|
||||
{
|
||||
["transID"] = "trans-1",
|
||||
["bufferedAudioBytes"] = 1234,
|
||||
["listenRules"] = new[] { "shared/yes_no", "globals/gui_nav" },
|
||||
["awaitingTurnCompletion"] = true
|
||||
});
|
||||
|
||||
var filePath = Directory.GetFiles(directoryPath, "*.events.ndjson").Single();
|
||||
var payload = JsonDocument.Parse(await File.ReadAllTextAsync(filePath)).RootElement;
|
||||
Assert.Equal("yes_no_turn_received", payload.GetProperty("type").GetString());
|
||||
Assert.Equal("trans-1", payload.GetProperty("details").GetProperty("transID").GetString());
|
||||
Assert.Equal(1234, payload.GetProperty("details").GetProperty("bufferedAudioBytes").GetInt32());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task RecordsTranscriptErrorOnTurnError()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user