Public Access
Make agent file writes append by default
PR and Push Build/Test / build-and-test (push) Failing after 6m36s
PR and Push Build/Test / build-and-test (push) Failing after 6m36s
This commit is contained in:
@@ -82,6 +82,46 @@ public sealed class WorkflowRulesEditorTests
|
||||
Assert.DoesNotContain("other.yaml", searchResult);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task RulesEditorToolsAppendByDefaultAndReplaceOnlyWhenRequested()
|
||||
{
|
||||
var root = Path.Combine(Path.GetTempPath(), "meeting-assistant-tests", Guid.NewGuid().ToString("N"));
|
||||
Directory.CreateDirectory(root);
|
||||
var rulesPath = Path.Combine(root, "rules.yaml");
|
||||
await File.WriteAllTextAsync(
|
||||
rulesPath,
|
||||
"""
|
||||
rules:
|
||||
- name: existing
|
||||
on:
|
||||
- created: {}
|
||||
steps:
|
||||
- uses: add_attendee
|
||||
value: Ada
|
||||
""");
|
||||
var tools = new WorkflowRulesEditorTools(new MeetingAssistantOptions
|
||||
{
|
||||
Automation = new AutomationOptions { RulesPath = rulesPath }
|
||||
});
|
||||
|
||||
await tools.WriteRules("""
|
||||
- name: appended
|
||||
on:
|
||||
- created: {}
|
||||
steps:
|
||||
- uses: add_attendee
|
||||
value: Grace
|
||||
""");
|
||||
|
||||
var appended = await File.ReadAllTextAsync(rulesPath);
|
||||
Assert.Contains("name: existing", appended);
|
||||
Assert.Contains("name: appended", appended);
|
||||
|
||||
await tools.WriteRules("rules: []", replace_file: true);
|
||||
|
||||
Assert.Equal("rules: []", await File.ReadAllTextAsync(rulesPath));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task RulesEditorToolsRefuseInvalidYamlWithoutOverwritingFile()
|
||||
{
|
||||
@@ -94,7 +134,7 @@ public sealed class WorkflowRulesEditorTests
|
||||
Automation = new AutomationOptions { RulesPath = rulesPath }
|
||||
});
|
||||
|
||||
var result = await tools.WriteRules("rules:\n- name: [");
|
||||
var result = await tools.WriteRules("rules:\n- name: [", replace_file: true);
|
||||
|
||||
Assert.StartsWith("Refused: workflow rules YAML is invalid.", result);
|
||||
Assert.Equal("rules: []", await File.ReadAllTextAsync(rulesPath));
|
||||
|
||||
Reference in New Issue
Block a user