# test.coordination/core/resolvers/snapshot.resolver.test.ts

> 21 lines of code and 0 definitions.

Tree: Codebase Testing
Language: typescript
Canonical: https://banes-lab.com/anatomy/testing#file-testing-test-coordination-core-resolvers-snapshot-resolver-test-ts
Source text: https://banes-lab.com/source/testing/test.coordination/core/resolvers/snapshot.resolver.test.ts.txt

Listed in [test.coordination/core/resolvers](https://banes-lab.com/api/source/testing/test.coordination/core/resolvers.md), after [test.coordination/core/resolvers/scope.resolver.test.ts](https://banes-lab.com/source/testing/test.coordination/core/resolvers/scope.resolver.test.ts.md) and before [test.coordination/core/resolvers/surface.resolver.test.ts](https://banes-lab.com/source/testing/test.coordination/core/resolvers/surface.resolver.test.ts.md).

## Contained in

- [test.coordination/core/resolvers](https://banes-lab.com/anatomy/testing/folder-testing-test-coordination-core-resolvers.md)

## Source

```typescript
import { describe, it } from "vitest";
import { unreadEcho, unreadSince } from "coordination-surface/tools/core/resolvers/snapshot.resolver.ts";
import assert from "node:assert/strict";
import { unreadItems } from "coordination-surface/tools/core/strings/snapshot.strings.ts";

const item = function item(key: string, at: number): string {
    return [`┌─── AGENT ${key} at:${String(at)} to:*`, "body", `└─── END AGENT ${key}`].join("\n");
};

describe("unreadSince and unreadEcho", () => {
    it("name the items other seats posted since a seat's snapshot, with their authors and the time they span", () => {
        const snapshot = item("B-1", 1000);
        const current = [snapshot, item("A-1", 2000), item("B-2", 5000), item("C-1", 3000)].join("\n");
        const interval = unreadSince(current, snapshot, "A");
        assert.deepEqual(interval, { agents: ["B", "C"], earliest: 3000, keys: ["B-2", "C-1"], latest: 5000 });
        assert.equal(unreadEcho(interval, "board.md"), unreadItems(["B", "C"], "board.md", 2, ["B-2", "C-1"]));
    });

    it("answer nothing without a snapshot or with nothing new", () => {
        assert.equal(unreadSince(item("B-1", 1), null, "A"), null);
        assert.equal(unreadSince(item("B-1", 1), item("B-1", 1), "A"), null);
        assert.equal(unreadEcho(null, "board.md"), "");
    });
});
```
