import { isApplicationJson } from '@/lib/security/content-type';
import { describe, expect, it } from 'vitest';

describe('demo API content type validation', () => {
  it.each([
    'application/json',
    'application/json; charset=utf-8',
    ' Application/JSON ; charset=UTF-8',
  ])('accepts %s', (value) => {
    expect(isApplicationJson(value)).toBe(true);
  });

  it.each([null, '', 'text/plain', 'application/jsonp', 'application/json-patch+json'])(
    'rejects %s',
    (value) => {
      expect(isApplicationJson(value)).toBe(false);
    },
  );
});
