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/interfaces')
-rw-r--r--tests/lib/mocha-3.1.2/test/acceptance/interfaces/bdd.spec.js34
-rw-r--r--tests/lib/mocha-3.1.2/test/acceptance/interfaces/exports.spec.js48
-rw-r--r--tests/lib/mocha-3.1.2/test/acceptance/interfaces/qunit.spec.js25
-rw-r--r--tests/lib/mocha-3.1.2/test/acceptance/interfaces/tdd.spec.js42
4 files changed, 149 insertions, 0 deletions
diff --git a/tests/lib/mocha-3.1.2/test/acceptance/interfaces/bdd.spec.js b/tests/lib/mocha-3.1.2/test/acceptance/interfaces/bdd.spec.js
new file mode 100644
index 0000000000..f6e24d88a8
--- /dev/null
+++ b/tests/lib/mocha-3.1.2/test/acceptance/interfaces/bdd.spec.js
@@ -0,0 +1,34 @@
+'use strict';
+
+describe('integer primitives', function () {
+ describe('arithmetic', function () {
+ it('should add', function () {
+ expect(1 + 1).to.equal(2);
+ expect(2 + 2).to.equal(4);
+ });
+
+ it('should subtract', function () {
+ expect(1 - 1).to.equal(0);
+ expect(2 - 1).to.equal(1);
+ });
+ });
+});
+
+describe('integer primitives', function () {
+ describe('arithmetic is not', function () {
+ it('should add', function () {
+ expect(1 + 1).not.to.equal(3);
+ expect(2 + 2).not.to.equal(5);
+ });
+ });
+});
+
+context('test suite', function () {
+ beforeEach(function () {
+ this.number = 5;
+ });
+
+ specify('share a property', function () {
+ expect(this.number).to.equal(5);
+ });
+});
diff --git a/tests/lib/mocha-3.1.2/test/acceptance/interfaces/exports.spec.js b/tests/lib/mocha-3.1.2/test/acceptance/interfaces/exports.spec.js
new file mode 100644
index 0000000000..f53c6a4ca0
--- /dev/null
+++ b/tests/lib/mocha-3.1.2/test/acceptance/interfaces/exports.spec.js
@@ -0,0 +1,48 @@
+'use strict';
+
+var calls = [];
+
+exports.Array = {
+ before: function () {
+ calls.push('before');
+ },
+
+ after: function () {
+ calls.push('after');
+ expect(calls)
+ .to
+ .eql([
+ 'before',
+ 'before each',
+ 'one',
+ 'after each',
+ 'before each',
+ 'two',
+ 'after each',
+ 'after'
+ ]);
+ },
+
+ '#indexOf()': {
+ beforeEach: function () {
+ calls.push('before each');
+ },
+
+ afterEach: function () {
+ calls.push('after each');
+ },
+
+ 'should return -1 when the value is not present': function () {
+ calls.push('one');
+ expect([1, 2, 3].indexOf(5)).to.equal(-1);
+ expect([1, 2, 3].indexOf(0)).to.equal(-1);
+ },
+
+ 'should return the correct index when the value is present': function () {
+ calls.push('two');
+ expect([1, 2, 3].indexOf(1)).to.equal(0);
+ expect([1, 2, 3].indexOf(2)).to.equal(1);
+ expect([1, 2, 3].indexOf(3)).to.equal(2);
+ }
+ }
+};
diff --git a/tests/lib/mocha-3.1.2/test/acceptance/interfaces/qunit.spec.js b/tests/lib/mocha-3.1.2/test/acceptance/interfaces/qunit.spec.js
new file mode 100644
index 0000000000..0d15272f0b
--- /dev/null
+++ b/tests/lib/mocha-3.1.2/test/acceptance/interfaces/qunit.spec.js
@@ -0,0 +1,25 @@
+'use strict';
+
+function ok (expr, msg) {
+ if (!expr) throw new Error(msg);
+}
+
+suite('integer primitives');
+
+test('should add', function () {
+ var number = 2 + 2;
+ ok(number === 4);
+});
+
+test('should decrement', function () {
+ var number = 3;
+ ok(--number === 2);
+ ok(--number === 1);
+ ok(--number === 0);
+});
+
+suite('String');
+
+test('#length', function () {
+ ok('foo'.length === 3);
+});
diff --git a/tests/lib/mocha-3.1.2/test/acceptance/interfaces/tdd.spec.js b/tests/lib/mocha-3.1.2/test/acceptance/interfaces/tdd.spec.js
new file mode 100644
index 0000000000..c2db518d70
--- /dev/null
+++ b/tests/lib/mocha-3.1.2/test/acceptance/interfaces/tdd.spec.js
@@ -0,0 +1,42 @@
+'use strict';
+
+suite('integer primitives', function () {
+ suite('arithmetic', function () {
+ var initialValue = 41;
+
+ suiteSetup(function (done) {
+ expect(initialValue).to.eql(41);
+ initialValue += 1;
+ done();
+ });
+
+ test('should add', function () {
+ expect(initialValue).to.eql(42);
+ expect(1 + 1).to.equal(2);
+ expect(2 + 2).to.equal(4);
+ });
+
+ test('should subtract', function () {
+ expect(initialValue).to.eql(42);
+ expect(1 - 1).to.equal(0);
+ expect(2 - 1).to.equal(1);
+ });
+
+ test.skip('should skip this test', function () {
+ var zero = 0;
+ expect(zero).to.equal(1, 'this test should have been skipped');
+ });
+
+ suite.skip('should skip this suite', function () {
+ test('should skip this test', function () {
+ var zero = 0;
+ expect(zero).to.equal(1, 'this test should have been skipped');
+ });
+ });
+
+ suiteTeardown(function (done) {
+ expect(initialValue).to.eql(42);
+ done();
+ });
+ });
+});