Public Access
Implement meeting assistant v1
This commit is contained in:
@@ -0,0 +1,76 @@
|
||||
using MeetingAssistant.MeetingNotes;
|
||||
using MeetingAssistant.Summary;
|
||||
using Microsoft.Extensions.Logging.Abstractions;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace MeetingAssistant.Tests;
|
||||
|
||||
public sealed class MeetingSummaryArtifactResolverTests
|
||||
{
|
||||
[Fact]
|
||||
public async Task ResolverFindsMeetingArtifactsForSummaryPath()
|
||||
{
|
||||
var root = Path.Combine(Path.GetTempPath(), "meeting-assistant-tests", Guid.NewGuid().ToString("N"));
|
||||
var notes = Path.Combine(root, "Meetings", "Notes");
|
||||
var summaries = Path.Combine(root, "Meetings", "Summaries");
|
||||
Directory.CreateDirectory(notes);
|
||||
Directory.CreateDirectory(summaries);
|
||||
var notePath = Path.Combine(notes, "meeting.md");
|
||||
await File.WriteAllTextAsync(
|
||||
notePath,
|
||||
"""
|
||||
---
|
||||
title: Meeting
|
||||
attendees:
|
||||
projects:
|
||||
transcript: "[[../Transcripts/transcript|Transcript]]"
|
||||
assistant_context: "[[../Assistant Context/context|Assistant Context]]"
|
||||
summary: "[[../Summaries/summary|Summary]]"
|
||||
---
|
||||
|
||||
User notes.
|
||||
""");
|
||||
var options = Options.Create(new MeetingAssistantOptions
|
||||
{
|
||||
Vault = new VaultOptions
|
||||
{
|
||||
MeetingNotesFolder = notes,
|
||||
SummariesFolder = summaries
|
||||
}
|
||||
});
|
||||
var resolver = new MeetingSummaryArtifactResolver(
|
||||
options,
|
||||
new MarkdownMeetingNoteStore(options, NullLogger<MarkdownMeetingNoteStore>.Instance));
|
||||
|
||||
var artifacts = await resolver.ResolveBySummaryPathAsync("summary.md", CancellationToken.None);
|
||||
|
||||
Assert.NotNull(artifacts);
|
||||
Assert.Equal(notePath, artifacts.MeetingNotePath);
|
||||
Assert.Equal(Path.Combine(root, "Meetings", "Transcripts", "transcript.md"), artifacts.TranscriptPath);
|
||||
Assert.Equal(Path.Combine(root, "Meetings", "Assistant Context", "context.md"), artifacts.AssistantContextPath);
|
||||
Assert.Equal(Path.Combine(summaries, "summary.md"), artifacts.SummaryPath);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ResolverRejectsSummaryPathOutsideConfiguredSummaryFolder()
|
||||
{
|
||||
var root = Path.Combine(Path.GetTempPath(), "meeting-assistant-tests", Guid.NewGuid().ToString("N"));
|
||||
var options = Options.Create(new MeetingAssistantOptions
|
||||
{
|
||||
Vault = new VaultOptions
|
||||
{
|
||||
MeetingNotesFolder = Path.Combine(root, "Notes"),
|
||||
SummariesFolder = Path.Combine(root, "Summaries")
|
||||
}
|
||||
});
|
||||
var resolver = new MeetingSummaryArtifactResolver(
|
||||
options,
|
||||
new MarkdownMeetingNoteStore(options, NullLogger<MarkdownMeetingNoteStore>.Instance));
|
||||
|
||||
var artifacts = await resolver.ResolveBySummaryPathAsync(
|
||||
Path.Combine(root, "Other", "summary.md"),
|
||||
CancellationToken.None);
|
||||
|
||||
Assert.Null(artifacts);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user