@agnishc/edb-append-system-prompt 0.10.8 → 0.10.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.10.9] - 2026-05-18
4
+
3
5
  ## [0.10.8] - 2026-05-18
4
6
 
5
7
  ## [0.10.6] - 2026-05-15
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agnishc/edb-append-system-prompt",
3
- "version": "0.10.8",
3
+ "version": "0.10.9",
4
4
  "description": "Pi extension: manage per-session system prompt snippets with add/delete UI",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -0,0 +1,48 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import { formatAge, wordCount } from "./utils.js";
3
+
4
+ describe("formatAge", () => {
5
+ it("formats seconds", () => {
6
+ const now = Date.now();
7
+ expect(formatAge(now - 0)).toBe("0s ago");
8
+ expect(formatAge(now - 30 * 1000)).toBe("30s ago");
9
+ });
10
+
11
+ it("formats minutes", () => {
12
+ const now = Date.now();
13
+ expect(formatAge(now - 60 * 1000)).toBe("1m ago");
14
+ expect(formatAge(now - 5 * 60 * 1000)).toBe("5m ago");
15
+ });
16
+
17
+ it("formats hours", () => {
18
+ const now = Date.now();
19
+ expect(formatAge(now - 3600 * 1000)).toBe("1h ago");
20
+ expect(formatAge(now - 12 * 3600 * 1000)).toBe("12h ago");
21
+ });
22
+
23
+ it("formats days", () => {
24
+ const now = Date.now();
25
+ expect(formatAge(now - 86400 * 1000)).toBe("1d ago");
26
+ expect(formatAge(now - 7 * 86400 * 1000)).toBe("7d ago");
27
+ });
28
+ });
29
+
30
+ describe("wordCount", () => {
31
+ it("counts words", () => {
32
+ expect(wordCount("hello world")).toBe(2);
33
+ expect(wordCount("one two three")).toBe(3);
34
+ });
35
+
36
+ it("ignores extra whitespace", () => {
37
+ expect(wordCount(" hello world ")).toBe(2);
38
+ });
39
+
40
+ it("returns 0 for empty string", () => {
41
+ expect(wordCount("")).toBe(0);
42
+ expect(wordCount(" ")).toBe(0);
43
+ });
44
+
45
+ it("handles newline-separated words", () => {
46
+ expect(wordCount("hello\nworld")).toBe(2);
47
+ });
48
+ });