import { afterAll, beforeAll, beforeEach, test } from 'vitest'; export interface DialectSuite { allTypes(context?: any): Promise; addBasicIndexes(context?: any): Promise; changeIndexFields(context?: any): Promise; dropIndex(context?: any): Promise; indexesToBeNotTriggered(context?: any): Promise; indexesTestCase1(context?: any): Promise; addNotNull(context?: any): Promise; addNotNullWithDataNoRollback(context?: any): Promise; addBasicSequences(context?: any): Promise; addGeneratedColumn(context?: any): Promise; addGeneratedToColumn(context?: any): Promise; dropGeneratedConstraint(context?: any): Promise; alterGeneratedConstraint(context?: any): Promise; createTableWithGeneratedConstraint(context?: any): Promise; createCompositePrimaryKey(context?: any): Promise; renameTableWithCompositePrimaryKey(context?: any): Promise; case1(): Promise; } export const run = ( suite: DialectSuite, beforeAllFn?: (context: any) => Promise, afterAllFn?: (context: any) => Promise, beforeEachFn?: (context: any) => Promise, ) => { let context: any = {}; beforeAll(beforeAllFn ? () => beforeAllFn(context) : () => {}); beforeEach(beforeEachFn ? () => beforeEachFn(context) : () => {}); test('No diffs for all database types', () => suite.allTypes(context)); test('Adding basic indexes', () => suite.addBasicIndexes(context)); test('Dropping basic index', () => suite.dropIndex(context)); test('Altering indexes', () => suite.changeIndexFields(context)); test('Indexes properties that should not trigger push changes', () => suite.indexesToBeNotTriggered(context)); test('Indexes test case #1', () => suite.indexesTestCase1(context)); test('Drop column', () => suite.case1()); test('Add not null to a column', () => suite.addNotNull()); test('Add not null to a column with null data. Should rollback', () => suite.addNotNullWithDataNoRollback()); test('Add basic sequences', () => suite.addBasicSequences()); test('Add generated column', () => suite.addGeneratedColumn(context)); test('Add generated constraint to an existing column', () => suite.addGeneratedToColumn(context)); test('Drop generated constraint from a column', () => suite.dropGeneratedConstraint(context)); // should ignore on push test('Alter generated constraint', () => suite.alterGeneratedConstraint(context)); test('Create table with generated column', () => suite.createTableWithGeneratedConstraint(context)); test('Rename table with composite primary key', () => suite.renameTableWithCompositePrimaryKey(context)); test('Create composite primary key', () => suite.createCompositePrimaryKey(context)); afterAll(afterAllFn ? () => afterAllFn(context) : () => {}); };