mirror of
https://github.com/MiniMax-AI/cli.git
synced 2026-09-18 08:48:06 +08:00
b540ee49f4
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
18 lines
594 B
TypeScript
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');
|
|
});
|
|
});
|