import { ContentModerationService } from './content-moderation.service';

describe('ContentModerationService', () => {
  const createService = (terms: string[] = []) =>
    new ContentModerationService({ get: jest.fn().mockReturnValue(terms) } as any);

  it('leaves normal musical content active', () => {
    expect(createService().analyze('جلسة عود جميلة في مقام الراست')).toEqual({
      flagged: false,
      score: 0,
      reasons: [],
    });
  });

  it('flags configured terms and detects link spam', () => {
    const result = createService(['blocked']).analyze(
      'blocked blocked https://one.test https://two.test https://three.test',
    );
    expect(result.flagged).toBe(true);
    expect(result.reasons).toEqual(expect.arrayContaining(['blocked_terms', 'excessive_links']));
  });
});
