import { describe, it, expect, beforeEach, afterEach } from 'vitest';
import { mkdtempSync, rmSync, existsSync } from 'fs';
import { tmpdir } from 'os';
import { join } from 'path';
import { ensureUserFolder, USER_SUBDIRS } from './paths.js';

describe('ensureUserFolder with notes subdir', () => {
  let tmpRoot: string;
  beforeEach(() => { tmpRoot = mkdtempSync(join(tmpdir(), 'ensure-notes-test-')); });
  afterEach(() => { rmSync(tmpRoot, { recursive: true, force: true }); });

  it('USER_SUBDIRS contains "notes"', () => {
    expect(USER_SUBDIRS).toContain('notes' as any);
  });

  it('creates notes/ inside user folder', () => {
    ensureUserFolder(tmpRoot, 'alice');
    expect(existsSync(join(tmpRoot, 'alice', 'notes'))).toBe(true);
  });
});
