feat: add bounded session and history navigation
Add session scrolling, latest-message navigation and fingerprint location under the shared UI gate; reuse navigation in history reads and provide read-only smoke. Navigation index snapshot passed 124 tests and a full build. Windows 4.1.13.63 read-only validation passed 10/10, including two-scroll history location; no sends. Record scope limits, including next-unread navigation not yet implemented.
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
using WxAgent.Core;
|
||||
using Xunit;
|
||||
|
||||
namespace WxAgent.Core.Tests;
|
||||
|
||||
public sealed class WechatNavigationTests
|
||||
{
|
||||
[Theory]
|
||||
[InlineData(0)]
|
||||
[InlineData(101)]
|
||||
public void RejectsUnboundedScrollRequests(int pages) =>
|
||||
Assert.Throws<WxAgentException>(() => WechatNavigationRules.ValidateScrollLimit(pages));
|
||||
|
||||
[Fact]
|
||||
public void MatchesExactVisibleFingerprintAndRejectsAmbiguity()
|
||||
{
|
||||
var message = new ChatMessageSnapshot("test", new string('a', 64), 0, ChatMessageType.Text);
|
||||
Assert.Same(message, WechatNavigationRules.FindMessage([message], new string('A', 64)));
|
||||
Assert.Null(WechatNavigationRules.FindMessage([message], new string('b', 64)));
|
||||
Assert.Throws<WxAgentException>(() => WechatNavigationRules.FindMessage([message, message], message.Fingerprint));
|
||||
Assert.Throws<WxAgentException>(() => WechatNavigationRules.FindMessage([message], "not-a-fingerprint"));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user