import { describe, it, expect } from 'vitest';
import { getAppShareRawUrl } from './api';

// 公開アプリ共有の raw URL 組み立ては純関数なので node 環境でそのままテストできる。
describe('getAppShareRawUrl', () => {
  it('builds the public app-share raw URL with an encoded path', () => {
    expect(getAppShareRawUrl('tok', 'a/b c.png')).toBe(
      '/api/app-share/tok/files/raw?path=a%2Fb+c.png',
    );
  });

  it('encodes special characters in the token-scoped path', () => {
    expect(getAppShareRawUrl('abc123', 'apps/x/index.html')).toBe(
      '/api/app-share/abc123/files/raw?path=apps%2Fx%2Findex.html',
    );
  });
});
