Skip to content

Beautiful, AI-native markdown IDE and LLM wiki

690 B
Raw Blame
import { describe, expect, test } from 'vitest';
import { isFileProtocolPage } from './file-protocol-page';

describe('isFileProtocolPage', () => {
  test('true for a file: page (packaged Electron renderer)', () => {
    expect(isFileProtocolPage({ protocol: 'file:' })).toBe(true);
  });

  test('false for http: (web, ok ui, dev desktop renderer on localhost)', () => {
    expect(isFileProtocolPage({ protocol: 'http:' })).toBe(false);
  });

  test('false for https:', () => {
    expect(isFileProtocolPage({ protocol: 'https:' })).toBe(false);
  });

  test('false when no window/location exists (unit tier has no DOM)', () => {
    expect(isFileProtocolPage()).toBe(false);
  });
});