Public Access
86 lines
2.8 KiB
C#
86 lines
2.8 KiB
C#
using MeetingAssistant.MeetingNotes;
|
|
using MeetingAssistant.Recording;
|
|
|
|
namespace MeetingAssistant.Tests;
|
|
|
|
public sealed class MeetingArtifactContentDetectorTests
|
|
{
|
|
[Fact]
|
|
public async Task IsDefaultOnlyReturnsFalseWhenTranscriptContainsSegment()
|
|
{
|
|
using var fixture = await DefaultArtifactFixture.CreateAsync();
|
|
await File.AppendAllTextAsync(
|
|
fixture.Artifacts.TranscriptPath,
|
|
"[00:00:01] Guest-1: hello" + Environment.NewLine);
|
|
|
|
var result = await MeetingArtifactContentDetector.IsDefaultOnlyAsync(
|
|
fixture.Artifacts,
|
|
CancellationToken.None);
|
|
|
|
Assert.False(result);
|
|
}
|
|
|
|
[Fact]
|
|
public async Task IsDefaultOnlyReturnsFalseWhenMeetingNoteContainsUserNotes()
|
|
{
|
|
using var fixture = await DefaultArtifactFixture.CreateAsync();
|
|
await File.AppendAllTextAsync(
|
|
fixture.Artifacts.MeetingNotePath,
|
|
"Manual note" + Environment.NewLine);
|
|
|
|
var result = await MeetingArtifactContentDetector.IsDefaultOnlyAsync(
|
|
fixture.Artifacts,
|
|
CancellationToken.None);
|
|
|
|
Assert.False(result);
|
|
}
|
|
|
|
private sealed class DefaultArtifactFixture : IDisposable
|
|
{
|
|
private DefaultArtifactFixture(string root, MeetingSessionArtifacts artifacts)
|
|
{
|
|
Root = root;
|
|
Artifacts = artifacts;
|
|
}
|
|
|
|
public string Root { get; }
|
|
|
|
public MeetingSessionArtifacts Artifacts { get; }
|
|
|
|
public static async Task<DefaultArtifactFixture> CreateAsync()
|
|
{
|
|
var root = Path.Combine(Path.GetTempPath(), "meeting-assistant-tests", Guid.NewGuid().ToString("N"));
|
|
Directory.CreateDirectory(root);
|
|
var artifacts = new MeetingSessionArtifacts(
|
|
Path.Combine(root, "meeting.md"),
|
|
Path.Combine(root, "transcript.md"),
|
|
Path.Combine(root, "assistant-context.md"),
|
|
Path.Combine(root, "summary.md"));
|
|
await File.WriteAllTextAsync(
|
|
artifacts.MeetingNotePath,
|
|
"""
|
|
---
|
|
title: Test
|
|
---
|
|
|
|
""");
|
|
await File.WriteAllTextAsync(
|
|
artifacts.TranscriptPath,
|
|
"# Meeting Transcript" + Environment.NewLine + Environment.NewLine);
|
|
await File.WriteAllTextAsync(
|
|
artifacts.AssistantContextPath,
|
|
"# Assistant Context" + Environment.NewLine + Environment.NewLine + "## Live Context" + Environment.NewLine);
|
|
|
|
return new DefaultArtifactFixture(root, artifacts);
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
if (Directory.Exists(Root))
|
|
{
|
|
Directory.Delete(Root, recursive: true);
|
|
}
|
|
}
|
|
}
|
|
}
|