UNPKG

ts-migrate-mongoose

Version:

A migration framework for Mongoose, built with TypeScript.

24 lines (20 loc) 517 B
import { describe, expect, it, vi } from 'vitest' import { Migrate } from '../src/commander' // Mock the Migrate class vi.mock('../src/commander', () => { return { Migrate: vi.fn().mockImplementation(() => { return { run: vi.fn(), } }), } }) describe('CLI', () => { it('should instantiate Migrate and call run', async () => { // Import the CLI script await import('../src/cli') // Check if Migrate was instantiated expect(Migrate).toHaveBeenCalledTimes(1) }) })