Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

1.2 KB
Raw Blame
import { describe, expect, it } from 'vitest';

import {
  resolveLocalDbFatalView,
  type UpdateStatusValue,
} from '../components/error/localDbFatalView';

describe('resolveLocalDbFatalView', () => {
  it.each(['ready', 'downloading', 'idle'] as const)('schema lock failure offers DB retry regardless of update status %s (#7135)', (status) => {
    expect(resolveLocalDbFatalView(status, 'DB_SCHEMA_LOCKED')).toBe('retry-local-db');
  });
  it('ready → install-update(补丁就绪,可一键重启安装)', () => {
    expect(resolveLocalDbFatalView('ready')).toBe('install-update');
  });

  it('checking / downloading / superseding → preparing-update(等待,禁止 relaunch)', () => {
    const preparing: UpdateStatusValue[] = ['checking', 'downloading', 'superseding'];
    for (const status of preparing) {
      expect(resolveLocalDbFatalView(status)).toBe('preparing-update');
    }
  });

  it('idle / error / undefined → no-update(引导重新检查更新)', () => {
    expect(resolveLocalDbFatalView('idle')).toBe('no-update');
    expect(resolveLocalDbFatalView('error')).toBe('no-update');
    expect(resolveLocalDbFatalView(undefined)).toBe('no-update');
  });
});