import { describe, expect, it } from 'vitest';
import {
  showVisibilityEdit,
  showTitleEdit,
  showFeedback,
  showMissionEdit,
  showHeaderActions,
  showDelete,
} from './detail-readonly';

describe('detail read-only predicates', () => {
  it('hides all edit affordances when read-only', () => {
    expect(showVisibilityEdit(true, true)).toBe(false);
    expect(showTitleEdit(true)).toBe(false);
    expect(showFeedback(true)).toBe(false);
    expect(showMissionEdit(true)).toBe(false);
    expect(showHeaderActions(true)).toBe(false);
    expect(showDelete(true)).toBe(false);
  });

  it('keeps authed (readonly=false) behavior unchanged', () => {
    // 可視性編集は権限次第（従来どおり）
    expect(showVisibilityEdit(false, true)).toBe(true);
    expect(showVisibilityEdit(false, false)).toBe(false);
    // 残りは authed では常に表示
    expect(showTitleEdit(false)).toBe(true);
    expect(showFeedback(false)).toBe(true);
    expect(showMissionEdit(false)).toBe(true);
    expect(showHeaderActions(false)).toBe(true);
    expect(showDelete(false)).toBe(true);
  });
});
