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

Unified Diff: appengine/config_service/ui/bower_components/sinon-chai/test/callOrder.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 side-by-side diff with in-line comments
Download patch
Index: appengine/config_service/ui/bower_components/sinon-chai/test/callOrder.coffee
diff --git a/appengine/config_service/ui/bower_components/sinon-chai/test/callOrder.coffee b/appengine/config_service/ui/bower_components/sinon-chai/test/callOrder.coffee
new file mode 100644
index 0000000000000000000000000000000000000000..43221c2118a87bb662e7ee90f92e6fd1710289b9
--- /dev/null
+++ b/appengine/config_service/ui/bower_components/sinon-chai/test/callOrder.coffee
@@ -0,0 +1,132 @@
+"use strict"
+
+sinon = require("sinon")
+
+describe "Call order", ->
+ spy1 = null
+ spy2 = null
+ spy3 = null
+
+ beforeEach ->
+ spy1 = sinon.spy()
+ spy2 = sinon.spy()
+ spy3 = sinon.spy()
+
+ describe "spy1 calledBefore spy2", ->
+ it "should throw an assertion error when neither spy is called", ->
+ expect(-> spy1.should.have.been.calledBefore(spy2)).to.throw(AssertionError)
+
+ it "should not throw when only spy 1 is called", ->
+ spy1()
+
+ expect(-> spy1.should.have.been.calledBefore(spy2)).to.not.throw()
+
+ it "should throw an assertion error when only spy 2 is called", ->
+ spy2()
+
+ expect(-> spy1.should.have.been.calledBefore(spy2)).to.throw(AssertionError)
+
+ it "should not throw when spy 1 is called before spy 2", ->
+ spy1()
+ spy2()
+
+ expect(-> spy1.should.have.been.calledBefore(spy2)).to.not.throw()
+
+ it "should throw an assertion error when spy 1 is called after spy 2", ->
+ spy2()
+ spy1()
+
+ expect(-> spy1.should.have.been.calledBefore(spy2)).to.throw(AssertionError)
+
+ describe "spy1 calledImmediatelyBefore spy2", ->
+ it "should throw an assertion error when neither spy is called", ->
+ expect(-> spy1.should.have.been.calledImmediatelyBefore(spy2)).to.throw(AssertionError)
+
+ it "should throw an assertion error when only spy 1 is called", ->
+ spy1()
+
+ expect(-> spy1.should.have.been.calledImmediatelyBefore(spy2)).to.throw(AssertionError)
+
+ it "should throw an assertion error when only spy 2 is called", ->
+ spy2()
+
+ expect(-> spy1.should.have.been.calledImmediatelyBefore(spy2)).to.throw(AssertionError)
+
+ it "should not throw when spy 1 is called immediately before spy 2", ->
+ spy1()
+ spy2()
+
+ expect(-> spy1.should.have.been.calledImmediatelyBefore(spy2)).to.not.throw()
+
+ it "should throw an assertion error when spy 1 is called before spy 2, but not immediately", ->
+ spy2()
+ spy3()
+ spy1()
+
+ expect(-> spy1.should.have.been.calledImmediatelyBefore(spy2)).to.throw(AssertionError)
+
+ it "should throw an assertion error when spy 1 is called after spy 2", ->
+ spy2()
+ spy1()
+
+ expect(-> spy1.should.have.been.calledImmediatelyBefore(spy2)).to.throw(AssertionError)
+
+ describe "spy1 calledAfter spy2", ->
+ it "should throw an assertion error when neither spy is called", ->
+ expect(-> spy1.should.have.been.calledAfter(spy2)).to.throw(AssertionError)
+
+ it "should throw an assertion error when only spy 1 is called", ->
+ spy1()
+
+ expect(-> spy1.should.have.been.calledAfter(spy2)).to.throw(AssertionError)
+
+ it "should throw an assertion error when only spy 2 is called", ->
+ spy2()
+
+ expect(-> spy1.should.have.been.calledAfter(spy2)).to.throw(AssertionError)
+
+ it "should throw an assertion error when spy 1 is called before spy 2", ->
+ spy1()
+ spy2()
+
+ expect(-> spy1.should.have.been.calledAfter(spy2)).to.throw(AssertionError)
+
+ it "should not throw when spy 1 is called after spy 2", ->
+ spy2()
+ spy1()
+
+ expect(-> spy1.should.have.been.calledAfter(spy2)).to.not.throw()
+
+ describe "spy1 calledImmediatelyAfter spy2", ->
+ it "should throw an assertion error when neither spy is called", ->
+ expect(-> spy1.should.have.been.calledImmediatelyAfter(spy2)).to.throw(AssertionError)
+
+ it "should throw an assertion error when only spy 1 is called", ->
+ spy1()
+
+ expect(-> spy1.should.have.been.calledImmediatelyAfter(spy2)).to.throw(AssertionError)
+
+ it "should throw an assertion error when only spy 2 is called", ->
+ spy2()
+
+ expect(-> spy1.should.have.been.calledImmediatelyAfter(spy2)).to.throw(AssertionError)
+
+ it "should throw an assertion error when spy 1 is called before spy 2", ->
+ spy1()
+ spy2()
+
+ expect(-> spy1.should.have.been.calledImmediatelyAfter(spy2)).to.throw(AssertionError)
+
+ it "should not throw when spy 1 is called immediately after spy 2", ->
+ spy2()
+ spy1()
+
+ expect(-> spy1.should.have.been.calledImmediatelyAfter(spy2)).to.not.throw()
+
+ it "should throw an assertion error when spy 1 is called after spy 2, but not immediately", ->
+ spy1()
+ spy3()
+ spy2()
+
+ expect(-> spy1.should.have.been.calledImmediatelyAfter(spy2)).to.throw(AssertionError)
+

Powered by Google App Engine
This is Rietveld 408576698