import { describe, expect, it } from 'vitest';
import { sha256Hex } from '../../src/api/hmac';

describe('hmac helpers', () => {
  it('hashes body as lowercase hex sha256', async () => {
    await expect(sha256Hex('{"a":1}')).resolves.toBe('015abd7f5cc57a2dd94b7590f04ad8084273905ee33ec5cebeae62276a97f862');
  });

  it('produces consistent hash for same input', async () => {
    const hash1 = await sha256Hex('hello');
    const hash2 = await sha256Hex('hello');
    expect(hash1).toBe(hash2);
  });

  it('produces different hashes for different input', async () => {
    const hash1 = await sha256Hex('hello');
    const hash2 = await sha256Hex('world');
    expect(hash1).not.toBe(hash2);
  });
});
