refactor
This commit is contained in:
@@ -92,7 +92,8 @@ public sealed class LegacyMimCatalogImporterTests
|
||||
|
||||
Assert.Contains("I like all the colors of the rainbow. But blue is my favorite.",
|
||||
catalog.PersonalityReplies);
|
||||
Assert.Contains("I never eat, so I don't have a favorite food by taste. But my favorite food by shape, is macaroni.",
|
||||
Assert.Contains(
|
||||
"I never eat, so I don't have a favorite food by taste. But my favorite food by shape, is macaroni.",
|
||||
catalog.PersonalityReplies);
|
||||
Assert.Contains("I mostly like fun music I can dance to.", catalog.PersonalityReplies);
|
||||
Assert.Contains("The only thing I consume is electricity.", catalog.PersonalityReplies);
|
||||
@@ -199,7 +200,8 @@ public sealed class LegacyMimCatalogImporterTests
|
||||
|
||||
var catalog = LegacyMimCatalogImporter.ImportCatalog(rootDirectory);
|
||||
|
||||
Assert.Contains("I love jokes. Did you hear about the theater actor who fell through the floorboards? He was just going through a stage.",
|
||||
Assert.Contains(
|
||||
"I love jokes. Did you hear about the theater actor who fell through the floorboards? He was just going through a stage.",
|
||||
catalog.Jokes);
|
||||
Assert.Contains("Sure I got one. What did the zero say to the eight. Nice belt.", catalog.Jokes);
|
||||
Assert.Contains(catalog.RobotFacts, reply =>
|
||||
@@ -211,7 +213,8 @@ public sealed class LegacyMimCatalogImporterTests
|
||||
Assert.Contains(catalog.RobotFacts, reply =>
|
||||
reply.Contains("two cameras but they're different focal lengths", StringComparison.OrdinalIgnoreCase));
|
||||
Assert.Contains("A random fact for you. A shrimp's heart is in its head.", catalog.FunFacts);
|
||||
Assert.Contains("An amazing but true fact for you. Dogs and elephants are the only animals that understand pointing.",
|
||||
Assert.Contains(
|
||||
"An amazing but true fact for you. Dogs and elephants are the only animals that understand pointing.",
|
||||
catalog.FunFacts);
|
||||
}
|
||||
|
||||
@@ -505,4 +508,4 @@ public sealed class LegacyMimCatalogImporterTests
|
||||
|
||||
return rootDirectory;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -426,7 +426,8 @@ public sealed class ProviderCachingTests
|
||||
entries.Select(entry =>
|
||||
$$"""{"dt":{{entry.Timestamp.ToUnixTimeSeconds()}},"main":{"temp":{{entry.Temp}},"temp_min":{{entry.Low}},"temp_max":{{entry.High}}},"weather":[{"main":"{{entry.Main}}","description":"{{entry.Description}}"}]}"""));
|
||||
|
||||
return $$"""{"city":{"name":"{{cityName}}","country":"{{country}}","timezone":{{timezoneSeconds}}},"list":[{{list}}]}""";
|
||||
return
|
||||
$$"""{"city":{"name":"{{cityName}}","country":"{{country}}","timezone":{{timezoneSeconds}}},"list":[{{list}}]}""";
|
||||
}
|
||||
|
||||
private sealed class CountingHttpMessageHandler(Func<HttpRequestMessage, HttpResponseMessage> responseFactory)
|
||||
@@ -456,4 +457,4 @@ public sealed class ProviderCachingTests
|
||||
return Task.FromResult(responseFactory(request));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -60,8 +60,9 @@ public sealed class FileProtocolTelemetrySinkTests : IDisposable
|
||||
|
||||
Assert.Contains("Notification_20150505", contents);
|
||||
Assert.DoesNotContain(Path.Combine("bin", "Debug"), captureFile, StringComparison.OrdinalIgnoreCase);
|
||||
Assert.Contains(indexLines, line => line.Contains("\"eventType\":\"protocol_record\"", StringComparison.Ordinal));
|
||||
Assert.Contains(indexLines,
|
||||
line => line.Contains("\"eventType\":\"protocol_record\"", StringComparison.Ordinal));
|
||||
Assert.Contains(indexLines, line => line.Contains("\"servicePrefix\":\"Notification_20150505\"",
|
||||
StringComparison.Ordinal));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -163,7 +163,8 @@ public sealed class JiboCloudProtocolServiceTests
|
||||
Method = "POST",
|
||||
ServicePrefix = "Update_20160715",
|
||||
Operation = "CreateUpdate",
|
||||
BodyText = """{"fromVersion":"1.0.0","toVersion":"1.0.1","changes":"Restore proof","subsystem":"robot"}"""
|
||||
BodyText =
|
||||
"""{"fromVersion":"1.0.0","toVersion":"1.0.1","changes":"Restore proof","subsystem":"robot"}"""
|
||||
});
|
||||
|
||||
await firstService.DispatchAsync(new ProtocolEnvelope
|
||||
@@ -209,16 +210,15 @@ public sealed class JiboCloudProtocolServiceTests
|
||||
Assert.NotNull(secondInfo.LastLoadedUtc);
|
||||
Assert.NotNull(secondInfo.LastSavedUtc);
|
||||
Assert.NotEmpty(updatesPayload.RootElement.EnumerateArray());
|
||||
Assert.Contains(updatesPayload.RootElement.EnumerateArray(), item => item.GetProperty("changes").GetString() == "Restore proof");
|
||||
Assert.Contains(updatesPayload.RootElement.EnumerateArray(),
|
||||
item => item.GetProperty("changes").GetString() == "Restore proof");
|
||||
Assert.NotEmpty(backupsPayload.RootElement.EnumerateArray());
|
||||
Assert.Contains(backupsPayload.RootElement.EnumerateArray(), item => item.TryGetProperty("Name", out var name) && name.GetString() == "manual-backup");
|
||||
Assert.Contains(backupsPayload.RootElement.EnumerateArray(),
|
||||
item => item.TryGetProperty("Name", out var name) && name.GetString() == "manual-backup");
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (File.Exists(persistencePath))
|
||||
{
|
||||
File.Delete(persistencePath);
|
||||
}
|
||||
if (File.Exists(persistencePath)) File.Delete(persistencePath);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -345,4 +345,4 @@ public sealed class JiboCloudProtocolServiceTests
|
||||
Assert.Contains(people,
|
||||
person => string.Equals(person.LoopId, store.GetLoops()[0].LoopId, StringComparison.OrdinalIgnoreCase));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -62,9 +62,11 @@ public sealed class FileTurnTelemetrySinkTests
|
||||
var indexPath = Path.Combine(directoryPath, "capture-index.ndjson");
|
||||
var lines = await File.ReadAllLinesAsync(indexPath);
|
||||
|
||||
Assert.Contains(lines, line => line.Contains("\"eventType\":\"yes_no_turn_received\"", StringComparison.Ordinal));
|
||||
Assert.Contains(lines,
|
||||
line => line.Contains("\"eventType\":\"yes_no_turn_received\"", StringComparison.Ordinal));
|
||||
Assert.Contains(lines, line => line.Contains("\"eventType\":\"transcript_error\"", StringComparison.Ordinal));
|
||||
Assert.Contains(lines, line => line.Contains("\"message\":\"Turn telemetry diagnostic\"", StringComparison.Ordinal));
|
||||
Assert.Contains(lines,
|
||||
line => line.Contains("\"message\":\"Turn telemetry diagnostic\"", StringComparison.Ordinal));
|
||||
Assert.Contains(lines, line => line.Contains("\"message\":\"Turn telemetry error\"", StringComparison.Ordinal));
|
||||
}
|
||||
|
||||
@@ -177,4 +179,4 @@ public sealed class FileTurnTelemetrySinkTests
|
||||
It.IsAny<CancellationToken>()),
|
||||
Times.AtLeastOnce());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -146,4 +146,4 @@ public sealed class FileWebSocketTelemetrySinkTests : IDisposable
|
||||
|
||||
return entries;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
using System.Text.Json;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using Jibo.Cloud.Application.Abstractions;
|
||||
using Jibo.Cloud.Application.Services;
|
||||
using Jibo.Cloud.Infrastructure.Content;
|
||||
@@ -3108,7 +3108,8 @@ public sealed class JiboInteractionServiceTests
|
||||
});
|
||||
|
||||
Assert.Equal("robot_can_sleep", decision.IntentName);
|
||||
Assert.Contains("I do. I usually fall asleep at night.", decision.ReplyText, StringComparison.OrdinalIgnoreCase);
|
||||
Assert.Contains("I do. I usually fall asleep at night.", decision.ReplyText,
|
||||
StringComparison.OrdinalIgnoreCase);
|
||||
Assert.Equal("ScriptedResponse", decision.ContextUpdates![ChitchatRouteKey]);
|
||||
}
|
||||
|
||||
@@ -4090,4 +4091,4 @@ public sealed class JiboInteractionServiceTests
|
||||
return Task.FromResult(Snapshot);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
using System.Text.Json;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using Jibo.Cloud.Application.Abstractions;
|
||||
using Jibo.Cloud.Application.Services;
|
||||
using Jibo.Cloud.Domain.Models;
|
||||
@@ -21,7 +21,7 @@ public sealed class JiboWebSocketServiceTests
|
||||
var contentRepository = new InMemoryJiboExperienceContentRepository();
|
||||
var contentCache = new JiboExperienceContentCache(contentRepository);
|
||||
var conversationBroker = new DemoConversationBroker(new JiboInteractionService(contentCache,
|
||||
new LastItemRandomizer(), new InMemoryPersonalMemoryStore(), null, null, null));
|
||||
new LastItemRandomizer(), new InMemoryPersonalMemoryStore()));
|
||||
var sttSelector = new DefaultSttStrategySelector(
|
||||
[
|
||||
new SyntheticBufferedAudioSttStrategy()
|
||||
@@ -2727,7 +2727,8 @@ public sealed class JiboWebSocketServiceTests
|
||||
Path = "/listen",
|
||||
Kind = "neo-hub-listen",
|
||||
Token = "hub-radio-noise-token",
|
||||
Text = """{"type":"CLIENT_ASR","transID":"trans-radio-noise","data":{"text":"Hey Jibo - so open the radio"}}"""
|
||||
Text =
|
||||
"""{"type":"CLIENT_ASR","transID":"trans-radio-noise","data":{"text":"Hey Jibo - so open the radio"}}"""
|
||||
});
|
||||
|
||||
Assert.Equal(4, replies.Count);
|
||||
@@ -4749,7 +4750,8 @@ public sealed class JiboWebSocketServiceTests
|
||||
Path = "/listen",
|
||||
Kind = "neo-hub-listen",
|
||||
Token = token,
|
||||
Text = """{"type":"LISTEN","transID":"trans-smoke-greeting","data":{"text":"hello jibo","rules":["wake-word"]}}"""
|
||||
Text =
|
||||
"""{"type":"LISTEN","transID":"trans-smoke-greeting","data":{"text":"hello jibo","rules":["wake-word"]}}"""
|
||||
});
|
||||
|
||||
Assert.Equal(3, greetingReplies.Count);
|
||||
@@ -4794,7 +4796,8 @@ public sealed class JiboWebSocketServiceTests
|
||||
Path = "/listen",
|
||||
Kind = "neo-hub-listen",
|
||||
Token = token,
|
||||
Text = """{"type":"CLIENT_ASR","transID":"trans-smoke-color","data":{"text":"what is your favorite color"}}"""
|
||||
Text =
|
||||
"""{"type":"CLIENT_ASR","transID":"trans-smoke-color","data":{"text":"what is your favorite color"}}"""
|
||||
});
|
||||
|
||||
Assert.Equal(3, personalityReplies.Count);
|
||||
@@ -5206,4 +5209,4 @@ public sealed class JiboWebSocketServiceTests
|
||||
return items[^1];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -190,7 +190,8 @@ public sealed class LocalWhisperCppBufferedAudioSttStrategyTests
|
||||
return page;
|
||||
}
|
||||
|
||||
private sealed class FakeExternalProcessRunner(string whisperStdOut = "[00:00:00.000 --> 00:00:01.000] tell me a joke")
|
||||
private sealed class FakeExternalProcessRunner(
|
||||
string whisperStdOut = "[00:00:00.000 --> 00:00:01.000] tell me a joke")
|
||||
: IExternalProcessRunner
|
||||
{
|
||||
public List<(string FileName, IReadOnlyList<string> Arguments)> Calls { get; } = [];
|
||||
@@ -208,4 +209,4 @@ public sealed class LocalWhisperCppBufferedAudioSttStrategyTests
|
||||
return Task.FromResult(new ExternalProcessResult(0, string.Empty, string.Empty));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,4 +22,4 @@ public sealed class SyntheticBufferedAudioSttStrategyTests
|
||||
Assert.Equal("synthetic-buffered-audio", result.Provider);
|
||||
Assert.Equal(0.75f, result.Confidence);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user