UNPKG

@t1mmen/srtd

Version:

Supabase Repeatable Template Definitions (srtd): 🪄 Live-reloading SQL templates for Supabase DX. Make your database changes reviewable and migrations maintainable! 🚀

26 lines • 979 B
import { render } from 'ink-testing-library'; import React from 'react'; import { beforeEach, describe, expect, test, vi } from 'vitest'; import Watch from '../commands/watch.js'; import { connect } from '../utils/databaseConnection.js'; vi.mock('ink', async (importOriginal) => { const actual = (await importOriginal()); return { ...actual, useApp: () => ({ exit: vi.fn() }), }; }); const wait = (ms) => new Promise(resolve => setTimeout(resolve, ms)); describe('Watch Command', () => { beforeEach(() => { vi.clearAllMocks(); }); test('renders initial state with no templates', async () => { await connect(); const { lastFrame } = render(React.createElement(Watch, null)); await wait(200); // Allow time for UI to render and DB to initialize expect(lastFrame()).toContain('Watch Mode'); expect(lastFrame()).toContain('No templates found'); }); }); //# sourceMappingURL=watch.test.js.map