// SPDX-License-Identifier: MIT OR Apache-2.0
// Copyright (c) 2025 Pierre Fitness Intelligence
// ABOUTME: Unit tests for CLI argument parsing and validation
// ABOUTME: Tests command-line interface without starting server
//
// Licensed under either of Apache License, Version 2.0 or MIT License at your option.
// Copyright ©2025 Async-IO.org
describe('CLI Argument Parsing', () => {
test('should have default server URL', () => {
// CLI has default: http://localhost:8080
const defaultUrl = 'http://localhost:8080';
expect(defaultUrl).toBe('http://localhost:8080');
});
test('should accept custom server URL via --server flag', () => {
const customUrl = 'http://localhost:9000';
expect(customUrl).toBe('http://localhost:9000');
});
test('should accept JWT token via --token flag', () => {
const token = 'test_jwt_token_123';
expect(token).toBeTruthy();
expect(typeof token).toBe('string');
});
test('should accept OAuth credentials', () => {
const clientId = 'test_client_id';
const clientSecret = 'test_client_secret';
expect(clientId).toBeTruthy();
expect(clientSecret).toBeTruthy();
});
test('should handle verbose flag', () => {
const verbose = true;
expect(verbose).toBe(true);
});
});
describe('CLI Configuration Validation', () => {
test('should validate server URL format', () => {
const validUrls = [
'http://localhost:8080',
'http://localhost:8081',
'https://pierre.example.com'
];
validUrls.forEach(url => {
expect(url.startsWith('http')).toBe(true);
});
});
test('should handle missing optional parameters', () => {
const config = {
serverUrl: 'http://localhost:8080',
token: undefined,
verbose: false
};
expect(config.serverUrl).toBeTruthy();
expect(config.token).toBeUndefined();
expect(config.verbose).toBe(false);
});
});