backup current stable ejclaw state

This commit is contained in:
Codex
2026-05-27 10:53:05 +09:00
parent 646bc34372
commit 1509108e04
57 changed files with 7127 additions and 154 deletions

View File

@@ -89,23 +89,101 @@ describe('renderUsageTable', () => {
expect(codexIdx).toBeGreaterThan(sepIdx);
});
it('omits separator when only Claude rows exist', () => {
it('shows "Codex: 조회 불가" when only Claude rows exist', () => {
const lines = renderUsageTable([claudeRow], []);
expect(lines.some((l) => /^─+$/.test(l))).toBe(false);
expect(lines.some((l) => l.includes('Claude'))).toBe(true);
expect(
lines.some((l) => l.includes('Codex') && l.includes('조회 불가')),
).toBe(true);
});
it('omits separator when only Codex rows exist', () => {
it('shows "Claude: 조회 불가" when only Codex rows exist', () => {
const lines = renderUsageTable([], [codexRow]);
expect(lines.some((l) => /^─+$/.test(l))).toBe(false);
expect(
lines.some((l) => l.includes('Claude') && l.includes('조회 불가')),
).toBe(true);
expect(lines.some((l) => l.includes('Codex'))).toBe(true);
});
it('returns fallback text when both groups are empty', () => {
it('shows separate 조회 불가 for both when both groups are empty', () => {
const lines = renderUsageTable([], []);
expect(lines).toEqual(['_조회 불가_']);
expect(
lines.some((l) => l.includes('Claude') && l.includes('조회 불가')),
).toBe(true);
expect(
lines.some((l) => l.includes('Codex') && l.includes('조회 불가')),
).toBe(true);
});
it('shows "Claude: 사용량 없음" when all Claude rows are at >=99% in a window', () => {
const exhaustedClaude: UsageRow = {
name: 'Claude pro',
h5pct: 99,
h5reset: '',
d7pct: 30,
d7reset: '',
};
const lines = renderUsageTable([exhaustedClaude], [codexRow]);
expect(
lines.some((l) => l.includes('Claude') && l.includes('사용량 없음')),
).toBe(true);
// Codex side should still render normally
expect(lines.some((l) => l.includes('Codex') && /\d+%/.test(l))).toBe(true);
});
it('shows "Codex: 사용량 없음" when all Codex rows are at 100% in either window', () => {
const exhaustedCodex: UsageRow = {
name: 'Codex',
h5pct: 100,
h5reset: '',
d7pct: 50,
d7reset: '',
};
const lines = renderUsageTable([claudeRow], [exhaustedCodex]);
expect(
lines.some((l) => l.includes('Codex') && l.includes('사용량 없음')),
).toBe(true);
});
it('treats <99% rows as having capacity remaining', () => {
const almostExhausted: UsageRow = {
name: 'Claude pro',
h5pct: 98,
h5reset: '',
d7pct: 50,
d7reset: '',
};
const lines = renderUsageTable([almostExhausted], [codexRow]);
// Should render the row as data, not the "사용량 없음" status line
expect(lines.some((l) => l.includes('사용량 없음'))).toBe(false);
});
it('treats source as exhausted only when ALL its rows are exhausted', () => {
const exhausted: UsageRow = {
name: 'Claude max',
h5pct: 100,
h5reset: '',
d7pct: 100,
d7reset: '',
};
const fresh: UsageRow = {
name: 'Claude pro',
h5pct: 10,
h5reset: '',
d7pct: 5,
d7reset: '',
};
const lines = renderUsageTable([exhausted, fresh], [codexRow]);
// Mixed exhausted/fresh → render rows normally, no 사용량 없음 banner
expect(lines.some((l) => l.includes('사용량 없음'))).toBe(false);
expect(lines.some((l) => l.includes('Claude max'))).toBe(true);
expect(lines.some((l) => l.includes('Claude pro'))).toBe(true);
});
});