noz-cli/NozCli.Tests/NotesCacheTests.cs
kryptomrx 0eebffe745 test: xUnit test suite and Forgejo CI pipeline
- 43 tests across SlugGuard, ReplContext navigation, NotesCache.TimeAgo
- SlugGuard moved to NozCli.Core.Security (shared between REPL and tests)
- Bug fix: FoldersInView() now returns only actual sub-folders, not note segments
  (previously cd tab-completion suggested note names as navigable folders)
- .forgejo/workflows/ci.yml: build + test on every push/PR
2026-05-16 23:53:40 +02:00

23 lines
654 B
C#

using Xunit;
using NozCli.Repl;
namespace NozCli.Tests;
public class NotesCacheTests
{
[Theory]
[InlineData(10, "gerade eben")]
[InlineData(59, "gerade eben")]
[InlineData(60, "vor 1 Min.")]
[InlineData(300, "vor 5 Min.")]
[InlineData(3599, "vor 59 Min.")]
[InlineData(3600, "vor 1 Std.")]
[InlineData(7200, "vor 2 Std.")]
[InlineData(86400, "vor 1 Tagen")]
public void TimeAgo_ReturnsCorrectLabel(int secondsAgo, string expected)
{
var dt = DateTimeOffset.UtcNow.AddSeconds(-secondsAgo);
var result = NotesCache.TimeAgo(dt);
Assert.Equal(expected, result);
}
}