diff options
Diffstat (limited to 'tests/lib/mocha-3.1.0/test/integration/diffs.spec.js')
-rw-r--r-- | tests/lib/mocha-3.1.0/test/integration/diffs.spec.js | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/lib/mocha-3.1.0/test/integration/diffs.spec.js b/tests/lib/mocha-3.1.0/test/integration/diffs.spec.js new file mode 100644 index 0000000000..b779b84ada --- /dev/null +++ b/tests/lib/mocha-3.1.0/test/integration/diffs.spec.js @@ -0,0 +1,44 @@ +var assert = require('assert'); +var helpers = require('./helpers'); +var run = helpers.runMocha; +var fs = require('fs'); +var getDiffs = helpers.getDiffs; + +function getExpectedOutput() { + var output = fs.readFileSync('test/integration/fixtures/diffs/output', 'UTF8'); + + // Diffs are delimited in file by "// DIFF" + return output.split(/\s*\/\/ DIFF/).slice(1).map(function(diff) { + return diff.split('\n').filter(Boolean).join('\n'); + }); +} + +describe('diffs', function() { + var diffs, expected; + + before(function(done) { + run('diffs/diffs.fixture.js', ['-C'], function(err, res) { + expected = getExpectedOutput(); + diffs = getDiffs(res.output); + done(err); + }); + }); + + [ + 'should display a diff for small strings', + 'should display a diff of canonicalized objects', + 'should display a diff for medium strings', + 'should display a diff for entire object dumps', + 'should display a diff for multi-line strings', + 'should display a diff for entire object dumps', + 'should display a full-comparison with escaped special characters', + 'should display a word diff for large strings', + 'should work with objects', + 'should show value diffs and not be affected by commas', + 'should display diff by data and not like an objects' + ].forEach(function(title, i) { + it(title, function() { + assert.equal(diffs[i], expected[i]); + }); + }); +}); |