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.

973 B
Raw Blame
import { render, waitFor } from '@solidjs/testing-library';
import { createSignal } from 'solid-js';
import { describe, expect, it, vi } from 'vitest';
import { SqlEditor } from './sql-editor';

describe('query SQL editor', () => {
  it('does not report externally accepted SQL as a user edit', async () => {
    const [value, setValue] = createSignal('SELECT 1');
    const onChange = vi.fn();
    const result = render(() => (
      <SqlEditor
        value={value()}
        schema={{ databaseId: 'db', name: 'Database', tables: [] }}
        onChange={onChange}
        onRun={() => {}}
      />
    ));
    await waitFor(() =>
      expect(result.getByRole('textbox').textContent).toBe('SELECT 1')
    );
    setValue('SELECT COUNT(*) FROM projects');
    await waitFor(() =>
      expect(result.getByRole('textbox').textContent).toBe(
        'SELECT COUNT(*) FROM projects'
      )
    );
    expect(onChange).not.toHaveBeenCalled();
    result.unmount();
  });
});