不要怂,就是干,撸起袖子干!

Commit 949208af by Sascha Depold

Fix the tests

1 parent b5334517
Showing with 12 additions and 6 deletions
......@@ -12,10 +12,17 @@ chai.config.includeStack = true
describe(Support.getTestDialectTeaser("Sequelize"), function () {
describe('log', function() {
beforeEach(function() {
this.spy = sinon.spy(console, 'log')
})
afterEach(function() {
console.log.restore()
})
describe("with disabled logging", function() {
beforeEach(function() {
this.sequelize = new Support.Sequelize('db', 'user', 'pw', { logging: false })
this.spy = sinon.spy(console.log)
})
it("does not call the log method of the logger", function() {
......@@ -27,32 +34,31 @@ describe(Support.getTestDialectTeaser("Sequelize"), function () {
describe('with default logging options', function() {
beforeEach(function() {
this.sequelize = new Support.Sequelize('db', 'user', 'pw')
this.spy = sinon.spy(console.log)
})
describe("called with no arguments", function() {
it('calls the log method', function() {
this.sequelize.log()
expect(this.spy.calledOnce).to.be.false
expect(this.spy.calledOnce).to.be.true
})
it('logs an empty string as info event', function() {
this.sequelize.log()
expect(this.spy.withArgs('').calledOnce).to.be.false
expect(this.spy.calledOnce).to.be.true
})
})
describe("called with one argument", function() {
it('logs the passed string as info event', function() {
this.sequelize.log('my message')
expect(this.spy.withArgs('my message').calledOnce).to.be.false
expect(this.spy.withArgs('my message').calledOnce).to.be.true
})
})
describe("called with more than two arguments", function() {
it("passes the arguments to the logger", function() {
this.sequelize.log('error', 'my message', 1, { a: 1 })
expect(this.spy.withArgs('error', 'my message', 1, { a: 1 }).calledOnce).to.be.false
expect(this.spy.withArgs('error', 'my message', 1, { a: 1 }).calledOnce).to.be.true
})
})
})
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!