Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib/mocha-3.1.0/test/hook-sync-nested.spec.js')
-rw-r--r--tests/lib/mocha-3.1.0/test/hook-sync-nested.spec.js98
1 files changed, 98 insertions, 0 deletions
diff --git a/tests/lib/mocha-3.1.0/test/hook-sync-nested.spec.js b/tests/lib/mocha-3.1.0/test/hook-sync-nested.spec.js
new file mode 100644
index 0000000000..b87c22298f
--- /dev/null
+++ b/tests/lib/mocha-3.1.0/test/hook-sync-nested.spec.js
@@ -0,0 +1,98 @@
+describe('serial', function(){
+ describe('nested', function(){
+ var calls = [];
+
+ beforeEach(function(){
+ calls.push('parent before');
+ if (this.currentTest) {
+ calls.push('parent before test ' + this.currentTest.title);
+ }
+ })
+
+ afterEach(function(){
+ calls.push('parent after');
+ if (this.currentTest) {
+ calls.push('parent after test ' + this.currentTest.title + ' ' + this.currentTest.state);
+ }
+ });
+
+ it('foo', function(){
+ calls.should.eql([
+ 'parent before'
+ , 'parent before test foo']);
+ calls.push('foo');
+ })
+
+ it('bar', function(){
+ calls.should.eql([
+ 'parent before'
+ , 'parent before test foo'
+ , 'foo'
+ , 'parent after'
+ , 'parent after test foo passed'
+ , 'parent before'
+ , 'parent before test bar']);
+ })
+
+ describe('hooks', function(){
+ beforeEach(function(){
+ calls.push('before');
+ if (this.currentTest) {
+ calls.push('before test ' + this.currentTest.title);
+ }
+ })
+
+ it('one', function(){
+ calls.should.eql([
+ 'parent before'
+ , 'parent before test foo'
+ , 'foo'
+ , 'parent after'
+ , 'parent after test foo passed'
+ , 'parent before'
+ , 'parent before test bar'
+ , 'parent after'
+ , 'parent after test bar passed'
+ , 'parent before'
+ , 'parent before test one'
+ , 'before'
+ , 'before test one']);
+ calls.push('one');
+ })
+
+ it('two', function(){
+ calls.should.eql([
+ 'parent before'
+ , 'parent before test foo'
+ , 'foo'
+ , 'parent after'
+ , 'parent after test foo passed'
+ , 'parent before'
+ , 'parent before test bar'
+ , 'parent after'
+ , 'parent after test bar passed'
+ , 'parent before'
+ , 'parent before test one'
+ , 'before'
+ , 'before test one'
+ , 'one'
+ , 'after'
+ , 'after test one passed'
+ , 'parent after'
+ , 'parent after test one passed'
+ , 'parent before'
+ , 'parent before test two'
+ , 'before'
+ , 'before test two']);
+ calls.push('two');
+ });
+
+ afterEach(function(){
+ calls.push('after');
+ if (this.currentTest) {
+ calls.push('after test ' + this.currentTest.title + ' ' + this.currentTest.state);
+ }
+ })
+ })
+ })
+})