Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(296)

Side by Side Diff: appengine/config_service/ui/bower_components/sinon-chai/test/callingWithNew.coffee

Issue 2923973003: Added base template for config ui. (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 "use strict"
2
3 sinon = require("sinon")
4
5 describe "Calling with new", ->
6 spy = null
7
8 beforeEach ->
9 spy = sinon.spy()
10
11 describe "calledWithNew", ->
12 it "should throw an assertion error if the spy is never called", ->
13 expect(-> spy.should.have.been.calledWithNew).to.throw(AssertionErro r)
14
15 it "should throw an assertion error if the spy is called without `new`", ->
16 spy()
17
18 expect(-> spy.should.have.been.calledWithNew).to.throw(AssertionErro r)
19 expect(-> spy.getCall(0).should.have.been.calledWithNew).to.throw(As sertionError)
20
21 it "should not throw if the spy is called with `new`", ->
22 new spy()
23
24 expect(-> spy.should.have.been.calledWithNew).to.not.throw()
25 expect(-> spy.getCall(0).should.have.been.calledWithNew).to.not.thro w()
26
27 it "should not throw if the spy is called with `new` and also without `n ew`", ->
28 spy()
29 new spy()
30
31 expect(-> spy.should.have.been.calledWithNew).to.not.throw()
32 expect(-> spy.getCall(1).should.have.been.calledWithNew).to.not.thro w()
33
34 describe "always calledWithNew", ->
35 it "should throw an assertion error if the spy is never called", ->
36 expect(-> spy.should.always.have.been.calledWithNew).to.throw(Assert ionError)
37 expect(-> spy.should.have.always.been.calledWithNew).to.throw(Assert ionError)
38 expect(-> spy.should.have.been.always.calledWithNew).to.throw(Assert ionError)
39
40 it "should throw an assertion error if the spy is called without `new`", ->
41 spy()
42
43 expect(-> spy.should.always.have.been.calledWithNew).to.throw(Assert ionError)
44 expect(-> spy.should.have.always.been.calledWithNew).to.throw(Assert ionError)
45 expect(-> spy.should.have.been.always.calledWithNew).to.throw(Assert ionError)
46
47 it "should not throw if the spy is called with `new`", ->
48 new spy()
49
50 expect(-> spy.should.always.have.been.calledWithNew).to.not.throw()
51 expect(-> spy.should.have.always.been.calledWithNew).to.not.throw()
52 expect(-> spy.should.have.been.always.calledWithNew).to.not.throw()
53
54 it "should throw an assertion error if the spy is called with `new` and also without `new`", ->
55 spy()
56 new spy()
57
58 expect(-> spy.should.always.have.been.calledWithNew).to.throw(Assert ionError)
59 expect(-> spy.should.have.always.been.calledWithNew).to.throw(Assert ionError)
60 expect(-> spy.should.have.been.always.calledWithNew).to.throw(Assert ionError)
61
62
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698