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/integration/fixtures/diffs/diffs.fixture.js')
-rw-r--r--tests/lib/mocha-3.1.2/test/integration/fixtures/diffs/diffs.fixture.js113
1 files changed, 113 insertions, 0 deletions
diff --git a/tests/lib/mocha-3.1.2/test/integration/fixtures/diffs/diffs.fixture.js b/tests/lib/mocha-3.1.2/test/integration/fixtures/diffs/diffs.fixture.js
new file mode 100644
index 0000000000..50ea00bee0
--- /dev/null
+++ b/tests/lib/mocha-3.1.2/test/integration/fixtures/diffs/diffs.fixture.js
@@ -0,0 +1,113 @@
+'use strict';
+
+var fs = require('fs');
+var cssin = fs.readFileSync('test/integration/fixtures/diffs/diffs.css.in', 'ascii');
+var cssout = fs.readFileSync('test/integration/fixtures/diffs/diffs.css.out', 'ascii');
+
+describe('diffs', function () {
+ var actual, expected;
+
+ it('should display a diff for small strings', function () {
+ actual = 'foo rar baz';
+ expected = 'foo bar baz';
+ actual.should.equal(expected);
+ });
+
+ it('should display a diff of canonicalized objects', function () {
+ actual = { name: 'travis j', age: 23 };
+ expected = { age: 23, name: 'travis' };
+ actual.should.equal(expected);
+ });
+
+ it('should display a diff for medium strings', function () {
+ actual = 'foo bar baz\nfoo rar baz\nfoo bar raz';
+ expected = 'foo bar baz\nfoo bar baz\nfoo bar baz';
+ actual.should.equal(expected);
+ });
+
+ it('should display a diff for entire object dumps', function () {
+ actual = {
+ name: 'joel',
+ age: 30,
+ address: {
+ city: 'new york',
+ country: 'usa'
+ }
+ };
+ expected = {
+ name: 'joe',
+ age: 30,
+ address: {
+ city: 'new york',
+ country: 'us'
+ }
+ };
+ actual.should.equal(expected);
+ });
+
+ it('should display a diff for multi-line strings', function () {
+ actual = 'one two three\nfour zzzz six\nseven eight nine';
+ expected = 'one two three\nfour five six\nseven eight nine';
+ actual.should.equal(expected);
+ });
+
+ it('should display a diff for entire object dumps', function () {
+ actual = {
+ name: 'joel',
+ age: 30,
+ address: {
+ city: 'new york',
+ country: 'usa'
+ }
+ };
+ expected = {
+ name: 'joe',
+ age: 30,
+ address: {
+ city: 'new york',
+ country: 'us'
+ }
+ };
+ actual.should.equal(expected);
+ });
+
+ it('should display a full-comparison with escaped special characters', function () {
+ actual = 'one\ttab\ntwo\t\t\ttabs';
+ expected = 'one\ttab\ntwo\t\ttabs';
+ actual.should.equal(expected);
+ });
+
+ it('should display a word diff for large strings', function () {
+ cssin.should.equal(cssout);
+ });
+
+ it('should work with objects', function () {
+ actual = {
+ name: 'tobi',
+ species: 'ferret',
+ color: 'white',
+ age: 2
+ };
+
+ expected = {
+ name: 'loki',
+ species: 'ferret',
+ color: 'brown',
+ age: 2
+ };
+
+ actual.should.eql(expected);
+ });
+
+ it('should show value diffs and not be affected by commas', function () {
+ actual = { a: 123 };
+ expected = { a: 123, b: 456 };
+ actual.should.equal(expected);
+ });
+
+ it('should display diff by data and not like an objects', function () {
+ actual = new Buffer([0x01]);
+ expected = new Buffer([0x02]);
+ actual.should.equal(expected);
+ });
+});