Makelore 2.0 initial clean snapshot

This commit is contained in:
inman
2026-07-29 17:22:35 +08:00
commit b8ca3f8eea
694 changed files with 139782 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
import { describe, expect, it } from 'vitest';
import { isWorksTokenUsageExhausted } from '@/lib/works-square-token-usage';
describe('isWorksTokenUsageExhausted', () => {
it('returns true when either rolling window is exhausted', () => {
expect(isWorksTokenUsageExhausted({
five_hour_remaining_percent: 50,
weekly_remaining_percent: 0,
})).toBe(true);
expect(isWorksTokenUsageExhausted({
five_hour_remaining_percent: 0,
weekly_remaining_percent: 40,
})).toBe(true);
});
it('returns false while both rolling windows have remaining allowance', () => {
expect(isWorksTokenUsageExhausted({
five_hour_remaining_percent: 50,
weekly_remaining_percent: 40,
})).toBe(false);
});
it('does not treat missing or non-finite usage as confirmed exhaustion', () => {
expect(isWorksTokenUsageExhausted(undefined)).toBe(false);
expect(isWorksTokenUsageExhausted({
five_hour_remaining_percent: null,
weekly_remaining_percent: Number.NaN,
})).toBe(false);
});
});