Files
dbmole-mcp/test/unit/cli.test.ts
T
2026-06-12 00:13:10 +05:00

23 lines
750 B
TypeScript

import { describe, expect, it } from 'vitest'
import { parseArgs } from '../../src/cli.js'
describe('parseArgs', () => {
it('prefers the --config flag', () => {
expect(parseArgs(['--config', '/tmp/c.json'], { DBMOLE_CONFIG: '/env.json' })).toEqual({
configPath: '/tmp/c.json'
})
})
it('falls back to DBMOLE_CONFIG env', () => {
expect(parseArgs([], { DBMOLE_CONFIG: '/env.json' })).toEqual({ configPath: '/env.json' })
})
it('returns undefined without flag or env', () => {
expect(parseArgs([], {})).toEqual({ configPath: undefined })
})
it('ignores --config without a value', () => {
expect(parseArgs(['--config'], {})).toEqual({ configPath: undefined })
})
})