Repository: sequelize/sequelize
File: packages/core/test/integration/query-interface.test.js (JavaScript)

Code before:
'use strict';

const uniq = require('lodash/uniq');

const chai = require('chai');

const expect = chai.expect;
const Support = require('./support');
const { DataTypes } = require('@sequelize/core');

const dialectName = Support.getTestDialect();
const dialect = Support.sequelize.dialect;

describe(Support.getTestDialectTeaser('QueryInterface'), () => {
  beforeEach(function () {
    this.sequelize.options.quoteIdenifiers = true;
    this.queryInterface = this.sequelize.queryInterface;
  });

  if (dialect.supports.schemas) {
    describe('dropAllSchema', () => {
      it('should drop all schema', async function () {
        await Support.dropTestSchemas(this.sequelize);
        const schemaNames = await this.queryInterface.listSchemas();
        await this.queryInterface.createSchema('newSchema');
        const newSchemaNames = await this.queryInterface.listSchemas();

        expect(newSchemaNames).to.have.length(schemaNames.length + 1);
      });
    });
  }

  describe('dropAllTables', () => {
    it('should drop all tables', async function () {
      await this.queryInterface.dropAllTables();
      const tableNames = await this.queryInterface.listTables();
      expect(tableNames).to.be.empty;

      await this.queryInterface.createTable('table', { name: DataTypes.STRING });
      const tableNames1 = await this.queryInterface.listTables();
      expect(tableNames1).to.have.length(1);

      await this.queryInterface.dropAllTables();
      const tableNames2 = await this.queryInterface.listTables();
      expect(tableNames2).to.be.empty;
    });

    it('should be able to skip given tables', async function () {

Review comment (suggestion):
this is the only change I'm opposed to as `dropAllSchema` is what is being tested and we can't guarantee we won't change `dropTestSchemas` in the future 

Code after:
'use strict';

const uniq = require('lodash/uniq');

const chai = require('chai');

const expect = chai.expect;
const Support = require('./support');
const { DataTypes } = require('@sequelize/core');

const dialectName = Support.getTestDialect();
const dialect = Support.sequelize.dialect;

describe('QueryInterface', () => {
  beforeEach(function () {
    this.sequelize.options.quoteIdenifiers = true;
    this.queryInterface = this.sequelize.queryInterface;
  });

  if (dialect.supports.schemas) {
    describe('dropAllSchema', () => {
      it('should drop all schema', async function () {
        await this.queryInterface.dropAllSchemas({
          skip: [this.sequelize.config.database],
        });
        const schemaNames = await this.queryInterface.listSchemas();
        await this.queryInterface.createSchema('newSchema');
        const newSchemaNames = await this.queryInterface.listSchemas();

        expect(newSchemaNames).to.have.length(schemaNames.length + 1);
      });
    });
  }

  describe('dropAllTables', () => {
    it('should drop all tables', async function () {
      await this.queryInterface.dropAllTables();
      const tableNames = await this.queryInterface.listTables();
      expect(tableNames).to.be.empty;

      await this.queryInterface.createTable('table', { name: DataTypes.STRING });
      const tableNames1 = await this.queryInterface.listTables();
      expect(tableNames1).to.have.length(1);

      await this.queryInterface.dropAllTables();
      const tableNames2 = await this.queryInterface.listTables();
      expect(tableNames2).to.be.empty;
    });