-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
58 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
namespace DotPrompt.Tests; | ||
|
||
public class FilePromptStoreTests | ||
{ | ||
[Fact] | ||
public void FilePromptStore_WithNoParameters_CreatesInstanceUsingDefaultPath() | ||
{ | ||
var promptStore = new FilePromptStore(); | ||
|
||
Assert.Equal("prompts", promptStore.PromptDirectory.Name); | ||
} | ||
|
||
[Fact] | ||
public void FilePromptStore_WithValidPath_CreatesInstance() | ||
{ | ||
var promptStore = new FilePromptStore("manager-prompts"); | ||
|
||
Assert.Equal("manager-prompts", promptStore.PromptDirectory.Name); | ||
} | ||
|
||
[Fact] | ||
public void FilePromptStore_WithInvalidPathSpecified_ThrowsException() | ||
{ | ||
var act = () => new FilePromptStore("does-not-exist"); | ||
|
||
var exception = Assert.Throws<ArgumentException>(act); | ||
Assert.Contains("The specified path does not exist", exception.Message); | ||
} | ||
|
||
[Fact] | ||
public void Load_WithVaryingCaseNames_RetrievesPromptsFromDirectory() | ||
{ | ||
var promptStore = new FilePromptStore(); | ||
|
||
var promptFiles = promptStore.Load().ToList(); | ||
|
||
Assert.Contains("basic", promptFiles.Select(p => p.Name)); | ||
Assert.Contains("example-with-name", promptFiles.Select(p => p.Name)); | ||
} | ||
|
||
[Fact] | ||
public void Load_WhenCalledOnDirectoryWithSubDirectories_RetrievesAllPromptFiles() | ||
{ | ||
var promptStore = new FilePromptStore("manager-prompts"); | ||
|
||
var promptFiles = promptStore.Load().ToList(); | ||
|
||
Assert.Equal(2, promptFiles.Count); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters