Files
minimax-ai__cli/test/auth/refresh.test.ts
tars90percent b540ee49f4 Initial commit: minimax-cli
CLI for the MiniMax API Platform (Token Plan). Supports 16 commands
across 10 resource groups: text chat, speech synthesis, image generation,
video generation, music generation, web search, image understanding,
quota management, auth, and config.

Features:
- Resource-verb grammar (minimax <resource> <command>)
- Auto-detects API region (global/cn) on first run
- Structured output (text, json, yaml)
- SSE streaming for chat
- Async polling for video generation
- Cross-compiles to standalone binaries via Bun
- Works with Node 18+ via npm install
2026-03-26 17:37:11 +08:00

18 lines
594 B
TypeScript

import { describe, it, expect } from 'bun:test';
import { ensureFreshToken } from '../../src/auth/refresh';
import type { CredentialFile } from '../../src/auth/types';
describe('ensureFreshToken', () => {
it('returns existing token when not expired', async () => {
const creds: CredentialFile = {
access_token: 'valid-token',
refresh_token: 'refresh-token',
expires_at: new Date(Date.now() + 3600000).toISOString(), // 1 hour from now
token_type: 'Bearer',
};
const token = await ensureFreshToken(creds);
expect(token).toBe('valid-token');
});
});