mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 11:41:38 +00:00
test: expand memory flush coverage
This commit is contained in:
@@ -56,6 +56,17 @@ describe("shouldRunMemoryFlush", () => {
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it("skips when entry is missing", () => {
|
||||
expect(
|
||||
shouldRunMemoryFlush({
|
||||
entry: undefined,
|
||||
contextWindowTokens: 16_000,
|
||||
reserveTokensFloor: 1_000,
|
||||
softThresholdTokens: DEFAULT_MEMORY_FLUSH_SOFT_TOKENS,
|
||||
}),
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it("skips when under threshold", () => {
|
||||
expect(
|
||||
shouldRunMemoryFlush({
|
||||
@@ -67,6 +78,17 @@ describe("shouldRunMemoryFlush", () => {
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it("triggers at the threshold boundary", () => {
|
||||
expect(
|
||||
shouldRunMemoryFlush({
|
||||
entry: { totalTokens: 85 },
|
||||
contextWindowTokens: 100,
|
||||
reserveTokensFloor: 10,
|
||||
softThresholdTokens: 5,
|
||||
}),
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
it("skips when already flushed for current compaction count", () => {
|
||||
expect(
|
||||
shouldRunMemoryFlush({
|
||||
|
||||
Reference in New Issue
Block a user