Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

651 B
Raw Blame
import { afterEach, describe, expect, it, vi } from 'vitest';

import { reportNativeFailure } from './reportFailure';

afterEach(() => {
  vi.unstubAllGlobals();
});

describe('reportNativeFailure', () => {
  it('hands the failure to the page error event', () => {
    const report = vi.fn();
    vi.stubGlobal('reportError', report);
    const err = new Error('share failed');
    reportNativeFailure(err);
    expect(report).toHaveBeenCalledWith(err);
  });

  it('does nothing where the runtime has no reportError', () => {
    vi.stubGlobal('reportError', undefined);
    expect(() => reportNativeFailure(new Error('x'))).not.toThrow();
  });
});