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.2/test/acceptance/context.spec.js')
-rw-r--r--tests/lib/mocha-3.1.2/test/acceptance/context.spec.js73
1 files changed, 73 insertions, 0 deletions
diff --git a/tests/lib/mocha-3.1.2/test/acceptance/context.spec.js b/tests/lib/mocha-3.1.2/test/acceptance/context.spec.js
new file mode 100644
index 0000000000..cbcdedb49d
--- /dev/null
+++ b/tests/lib/mocha-3.1.2/test/acceptance/context.spec.js
@@ -0,0 +1,73 @@
+'use strict';
+
+describe('Context', function () {
+ beforeEach(function () {
+ this.calls = ['before'];
+ });
+
+ describe('nested', function () {
+ beforeEach(function () {
+ this.calls.push('before two');
+ });
+
+ it('should work', function () {
+ expect(this.calls).to.eql(['before', 'before two']);
+ this.calls.push('test');
+ });
+
+ after(function () {
+ expect(this.calls).to.eql(['before', 'before two', 'test']);
+ this.calls.push('after two');
+ });
+ });
+
+ after(function () {
+ expect(this.calls).to.eql(['before', 'before two', 'test', 'after two']);
+ });
+});
+
+describe('Context Siblings', function () {
+ beforeEach(function () {
+ this.calls = ['before'];
+ });
+
+ describe('sequestered sibling', function () {
+ beforeEach(function () {
+ this.calls.push('before two');
+ this.hiddenFromSibling = 'This should be hidden';
+ });
+
+ it('should work', function () {
+ expect(this.hiddenFromSibling).to.eql('This should be hidden');
+ });
+ });
+
+ describe('sibling verifiction', function () {
+ beforeEach(function () {
+ this.calls.push('before sibling');
+ });
+
+ it('should not have value set within a sibling describe', function () {
+ expect('This should be hidden').not.to.eql(this.hiddenFromSibling);
+ this.visibleFromTestSibling = 'Visible from test sibling';
+ });
+
+ it('should allow test siblings to modify shared context', function () {
+ expect('Visible from test sibling').to.eql(this.visibleFromTestSibling);
+ });
+
+ it('should have reset this.calls before describe', function () {
+ expect(this.calls).to.eql(['before', 'before sibling']);
+ });
+ });
+
+ after(function () {
+ expect(this.calls).to.eql(['before', 'before sibling']);
+ });
+});
+
+describe('timeout()', function () {
+ it('should return the timeout', function () {
+ expect(this.timeout()).to.equal(200);
+ });
+});