Files
brain/tools/standby-mode-control.test.mjs
T

24 lines
1.4 KiB
JavaScript
Raw Normal View History

import { describe, it, expect } from 'vitest';
import { decideControl } from './standby-mode-control.mjs';
describe('decideControl — переходы штатного режима', () => {
it('«штатный режим» без active/pending → pending (переспрос)', () => {
expect(decideControl({ text: 'перейди в штатный режим', active: false, pending: false }).action).toBe('pending');
});
it('«да, штатный» при pending → enable', () => {
expect(decideControl({ text: 'да, штатный', active: false, pending: true }).action).toBe('enable');
});
it('«да, штатный» без pending → НЕ enable (двухтактное рукопожатие)', () => {
expect(decideControl({ text: 'да, штатный', active: false, pending: false }).action).not.toBe('enable');
});
it('«выключи штатный» → disable', () => {
expect(decideControl({ text: 'выключи штатный', active: true, pending: false }).action).toBe('disable');
});
it('активен, обычный промпт → banner', () => {
expect(decideControl({ text: 'что по задаче', active: true, pending: false }).action).toBe('banner');
});
it('ничего не подходит → none', () => {
expect(decideControl({ text: 'привет', active: false, pending: false }).action).toBe('none');
});
});