import { describe, expect, it } from 'vitest';
import { readFileSync } from 'node:fs';
import { join } from 'node:path';

import { containedJsonTextClass, containedLongTextClass } from './text-wrapping';

const globalsCss = readFileSync(join(process.cwd(), 'app/globals.css'), 'utf8');

describe('contained long text classes', () => {
  it('keeps long plain text inside its container', () => {
    expect(containedLongTextClass).toBe('contained-long-text');
    expect(globalsCss).toContain('.contained-long-text');
    expect(globalsCss).toContain('overflow-wrap: anywhere');
    expect(globalsCss).toContain('word-break: break-word');
  });

  it('keeps long JSON and monospace output inside its container', () => {
    expect(containedJsonTextClass).toBe('contained-json-text');
    expect(globalsCss).toContain('.contained-json-text');
    expect(globalsCss).toContain('white-space: pre-wrap');
  });
});
