Update MigrationManager.test.js - moved migrations ensureDir to init()

This commit is contained in:
advplyr 2024-09-24 16:54:13 -05:00
parent 8a7b5cc87d
commit c67b5e950e

View File

@ -63,6 +63,8 @@ describe('MigrationManager', () => {
await migrationManager.init(serverVersion) await migrationManager.init(serverVersion)
// Assert // Assert
expect(fsEnsureDirStub.calledOnce).to.be.true
expect(fsEnsureDirStub.calledWith(migrationManager.migrationsDir)).to.be.true
expect(migrationManager.serverVersion).to.equal(serverVersion) expect(migrationManager.serverVersion).to.equal(serverVersion)
expect(migrationManager.sequelize).to.equal(sequelizeStub) expect(migrationManager.sequelize).to.equal(sequelizeStub)
expect(migrationManager.migrationsDir).to.equal(path.join(__dirname, 'migrations')) expect(migrationManager.migrationsDir).to.equal(path.join(__dirname, 'migrations'))
@ -353,8 +355,6 @@ describe('MigrationManager', () => {
await migrationManager.copyMigrationsToConfigDir() await migrationManager.copyMigrationsToConfigDir()
// Assert // Assert
expect(fsEnsureDirStub.calledOnce).to.be.true
expect(fsEnsureDirStub.calledWith(targetDir)).to.be.true
expect(readdirStub.calledOnce).to.be.true expect(readdirStub.calledOnce).to.be.true
expect(readdirStub.calledWith(migrationsSourceDir)).to.be.true expect(readdirStub.calledWith(migrationsSourceDir)).to.be.true
expect(fsCopyStub.calledTwice).to.be.true expect(fsCopyStub.calledTwice).to.be.true
@ -382,8 +382,6 @@ describe('MigrationManager', () => {
} catch (error) {} } catch (error) {}
// Assert // Assert
expect(fsEnsureDirStub.calledOnce).to.be.true
expect(fsEnsureDirStub.calledWith(targetDir)).to.be.true
expect(readdirStub.calledOnce).to.be.true expect(readdirStub.calledOnce).to.be.true
expect(readdirStub.calledWith(migrationsSourceDir)).to.be.true expect(readdirStub.calledWith(migrationsSourceDir)).to.be.true
expect(fsCopyStub.calledTwice).to.be.true expect(fsCopyStub.calledTwice).to.be.true