@inferhub/usage 0.1.10 → 0.1.11
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/dist/format.test.js +4 -7
- package/package.json +1 -1
- package/src/format.test.ts +4 -7
package/dist/format.test.js
CHANGED
|
@@ -7,7 +7,7 @@ test("normalizeBaseUrl adds /v1", () => {
|
|
|
7
7
|
test("usageUrl", () => {
|
|
8
8
|
assert.equal(usageUrl("https://api.inferhub.dev", "day", "UTC", "abc"), "https://api.inferhub.dev/v1/me/usage?window=day&tz=UTC&session_id=abc");
|
|
9
9
|
});
|
|
10
|
-
test("formatStatusLine
|
|
10
|
+
test("formatStatusLine has sess/day/all/bal without top model", () => {
|
|
11
11
|
const usage = {
|
|
12
12
|
object: "account.usage",
|
|
13
13
|
currency: "USDC",
|
|
@@ -49,12 +49,9 @@ test("formatStatusLine includes tokens compactly", () => {
|
|
|
49
49
|
cache: { cached: false, ttl_seconds: 30 },
|
|
50
50
|
};
|
|
51
51
|
const line = formatStatusLine(usage, { model: "grok-4.5", contextPct: 8 });
|
|
52
|
-
assert.equal(line, "InferHub · sess 19r/6.0M · day 129r/26.4M · all $0.41/3.9kr/354.2M · bal $1.31
|
|
53
|
-
assert.
|
|
54
|
-
assert.
|
|
55
|
-
assert.match(line, /354\.2M/);
|
|
56
|
-
assert.doesNotMatch(line, /3933r/);
|
|
57
|
-
// empty session omitted
|
|
52
|
+
assert.equal(line, "InferHub · sess 19r/6.0M · day 129r/26.4M · all $0.41/3.9kr/354.2M · bal $1.31");
|
|
53
|
+
assert.doesNotMatch(line, /top /);
|
|
54
|
+
assert.doesNotMatch(line, /gpt-5\.5/);
|
|
58
55
|
const noSess = { ...usage, session: null };
|
|
59
56
|
assert.doesNotMatch(formatStatusLine(noSess), /sess /);
|
|
60
57
|
assert.equal(money("0"), "$0");
|
package/package.json
CHANGED
package/src/format.test.ts
CHANGED
|
@@ -14,7 +14,7 @@ test("usageUrl", () => {
|
|
|
14
14
|
);
|
|
15
15
|
});
|
|
16
16
|
|
|
17
|
-
test("formatStatusLine
|
|
17
|
+
test("formatStatusLine has sess/day/all/bal without top model", () => {
|
|
18
18
|
const usage: AccountUsage = {
|
|
19
19
|
object: "account.usage",
|
|
20
20
|
currency: "USDC",
|
|
@@ -59,14 +59,11 @@ test("formatStatusLine includes tokens compactly", () => {
|
|
|
59
59
|
const line = formatStatusLine(usage, { model: "grok-4.5", contextPct: 8 });
|
|
60
60
|
assert.equal(
|
|
61
61
|
line,
|
|
62
|
-
"InferHub · sess 19r/6.0M · day 129r/26.4M · all $0.41/3.9kr/354.2M · bal $1.31
|
|
62
|
+
"InferHub · sess 19r/6.0M · day 129r/26.4M · all $0.41/3.9kr/354.2M · bal $1.31",
|
|
63
63
|
);
|
|
64
|
-
assert.
|
|
65
|
-
assert.
|
|
66
|
-
assert.match(line, /354\.2M/);
|
|
67
|
-
assert.doesNotMatch(line, /3933r/);
|
|
64
|
+
assert.doesNotMatch(line, /top /);
|
|
65
|
+
assert.doesNotMatch(line, /gpt-5\.5/);
|
|
68
66
|
|
|
69
|
-
// empty session omitted
|
|
70
67
|
const noSess = { ...usage, session: null };
|
|
71
68
|
assert.doesNotMatch(formatStatusLine(noSess), /sess /);
|
|
72
69
|
|