Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

1.3 KB
Raw Blame
/**
 * @vitest-environment jsdom
 */

import { describe, expect, it, vi } from 'vitest';
import { shouldShowLoadError } from './empty-states';

vi.mock('@app/features/command/Launcher', () => ({
  useCreateAction: () => vi.fn(),
}));
vi.mock('@channel/CreateChannelModal', () => ({
  openNewChannelModal: vi.fn(),
}));
vi.mock('@core/constant/SettingsState', () => ({
  useSettingsState: () => ({ openSettings: vi.fn() }),
}));
vi.mock('@core/email-link', () => ({
  useAddInboxFlow: () => vi.fn(),
  useEmailLinksStatus: () => () => false,
}));
vi.mock('@queries/team/teams', () => ({
  useCurrentTeamQuery: () => ({ data: undefined }),
  useIsTeamAdmin: () => () => false,
}));
vi.mock('./FolderDropZone', () => ({ FolderDropZone: () => null }));
vi.mock('./soup-view-context', () => ({
  useSoupView: () => ({ activeTab: () => undefined, searchText: () => '' }),
}));

describe('shouldShowLoadError', () => {
  it('replaces stale rendered rows when the active query has no data', () => {
    expect(
      shouldShowLoadError({
        hasData: false,
        forceEmptyState: false,
      })
    ).toBe(true);
    expect(
      shouldShowLoadError({
        hasData: true,
        forceEmptyState: false,
      })
    ).toBe(false);
    expect(
      shouldShowLoadError({
        hasData: false,
        forceEmptyState: true,
      })
    ).toBe(false);
  });
});