import { TestCase } from './test-case';

export class TestCaseSqlScript extends TestCase {

constructor(private sqlScripts: string[], private tablesNamesToReset?: string[]) {
    super();
  }

  protected override execute(): void {
    if (this.tablesNamesToReset) {
      cy.task('resetTablesDbQry', {tablesNamesToReset: this.tablesNamesToReset});
    }

    this.sqlScripts.forEach(sqlScript =>
      cy.task('executeDbCommand', {
        sqlScript: sqlScript
      })
    );
  }
}
