import { describe, expect, it } from 'vitest';
import { CarEngineSoundSchema, DoorSoundSchema, PROTOCOL_VERSION } from '../src/index.ts';

describe('protocol', () => {
  it('версия протокола 4', () => {
    expect(PROTOCOL_VERSION).toBe(4);
  });

  it('вид звука двери: entrance и lift, другое — ошибка (спека звуков дверей §4.1)', () => {
    expect(DoorSoundSchema.parse('entrance')).toBe('entrance');
    expect(DoorSoundSchema.parse('lift')).toBe('lift');
    expect(DoorSoundSchema.safeParse('bell').success).toBe(false);
  });

  it('голос мотора: hatch, sedan, suv, sport, другое — ошибка (спека звуков транспорта §4.2)', () => {
    expect(CarEngineSoundSchema.options).toEqual(['hatch', 'sedan', 'suv', 'sport']);
    expect(CarEngineSoundSchema.safeParse('truck').success).toBe(false);
  });
});
