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 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;
    });


Review comment (suggestion):
```suggestion
        await this.queryInterface.dropAllSchemas({
          skip: [this.sequelize.config.database],
```
Trying to edit from my phone but it's not going great. Maybe this helps

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;
    });