| Index: appengine/config_service/ui/bower_components/sinon-chai/test/callingWithNew.coffee
|
| diff --git a/appengine/config_service/ui/bower_components/sinon-chai/test/callingWithNew.coffee b/appengine/config_service/ui/bower_components/sinon-chai/test/callingWithNew.coffee
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..7f1fb8d8e456716c23a8d6bdc9f339712555fffa
|
| --- /dev/null
|
| +++ b/appengine/config_service/ui/bower_components/sinon-chai/test/callingWithNew.coffee
|
| @@ -0,0 +1,62 @@
|
| +"use strict"
|
| +
|
| +sinon = require("sinon")
|
| +
|
| +describe "Calling with new", ->
|
| + spy = null
|
| +
|
| + beforeEach ->
|
| + spy = sinon.spy()
|
| +
|
| + describe "calledWithNew", ->
|
| + it "should throw an assertion error if the spy is never called", ->
|
| + expect(-> spy.should.have.been.calledWithNew).to.throw(AssertionError)
|
| +
|
| + it "should throw an assertion error if the spy is called without `new`", ->
|
| + spy()
|
| +
|
| + expect(-> spy.should.have.been.calledWithNew).to.throw(AssertionError)
|
| + expect(-> spy.getCall(0).should.have.been.calledWithNew).to.throw(AssertionError)
|
| +
|
| + it "should not throw if the spy is called with `new`", ->
|
| + new spy()
|
| +
|
| + expect(-> spy.should.have.been.calledWithNew).to.not.throw()
|
| + expect(-> spy.getCall(0).should.have.been.calledWithNew).to.not.throw()
|
| +
|
| + it "should not throw if the spy is called with `new` and also without `new`", ->
|
| + spy()
|
| + new spy()
|
| +
|
| + expect(-> spy.should.have.been.calledWithNew).to.not.throw()
|
| + expect(-> spy.getCall(1).should.have.been.calledWithNew).to.not.throw()
|
| +
|
| + describe "always calledWithNew", ->
|
| + it "should throw an assertion error if the spy is never called", ->
|
| + expect(-> spy.should.always.have.been.calledWithNew).to.throw(AssertionError)
|
| + expect(-> spy.should.have.always.been.calledWithNew).to.throw(AssertionError)
|
| + expect(-> spy.should.have.been.always.calledWithNew).to.throw(AssertionError)
|
| +
|
| + it "should throw an assertion error if the spy is called without `new`", ->
|
| + spy()
|
| +
|
| + expect(-> spy.should.always.have.been.calledWithNew).to.throw(AssertionError)
|
| + expect(-> spy.should.have.always.been.calledWithNew).to.throw(AssertionError)
|
| + expect(-> spy.should.have.been.always.calledWithNew).to.throw(AssertionError)
|
| +
|
| + it "should not throw if the spy is called with `new`", ->
|
| + new spy()
|
| +
|
| + expect(-> spy.should.always.have.been.calledWithNew).to.not.throw()
|
| + expect(-> spy.should.have.always.been.calledWithNew).to.not.throw()
|
| + expect(-> spy.should.have.been.always.calledWithNew).to.not.throw()
|
| +
|
| + it "should throw an assertion error if the spy is called with `new` and also without `new`", ->
|
| + spy()
|
| + new spy()
|
| +
|
| + expect(-> spy.should.always.have.been.calledWithNew).to.throw(AssertionError)
|
| + expect(-> spy.should.have.always.been.calledWithNew).to.throw(AssertionError)
|
| + expect(-> spy.should.have.been.always.calledWithNew).to.throw(AssertionError)
|
| +
|
| +
|
|
|