Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
44 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,87 +1,87 @@ | ||
var test = function(done) { | ||
return function(error, text) { | ||
expect(text).to.be.null; | ||
expect(error).to.be.an('object'); | ||
expect(error.message).to.be.an('string'); | ||
expect(error.message).to.eql("Incorrect parameters passed to textract."); | ||
/* global fromUrl */ | ||
|
||
var test = function( done ) { | ||
return function( error, text ) { | ||
expect( text ).to.be.null; | ||
expect( error ).to.be.an( 'object' ); | ||
expect( error.message ).to.be.an( 'string' ); | ||
expect( error.message ).to.eql( 'Incorrect parameters passed to textract.' ); | ||
done(); | ||
} | ||
} | ||
}; | ||
}; | ||
|
||
var pathTests = function(testFunction) { | ||
var pathTests = function( testFunction ) { | ||
|
||
var funct; | ||
|
||
beforeEach(function() { | ||
beforeEach( function() { | ||
funct = testFunction(); | ||
}); | ||
|
||
it('should return an error 1', function(done) { | ||
funct(test(done)); | ||
it( 'should return an error 1', function( done ) { | ||
funct( test( done ) ); | ||
}); | ||
|
||
it('should return an error 2', function(done) { | ||
funct(false, test(done)); | ||
it( 'should return an error 2', function( done ) { | ||
funct( false, test( done ) ); | ||
}); | ||
|
||
it('should return an error 3', function(done) { | ||
funct(test(done), false); | ||
it( 'should return an error 3', function( done ) { | ||
funct( test( done ), false ); | ||
}); | ||
|
||
it('should return an error 4', function(done) { | ||
funct("foo", test(done), false); | ||
it( 'should return an error 4', function( done ) { | ||
funct( 'foo', test( done ), false ); | ||
}); | ||
|
||
it('should return an error 5', function(done) { | ||
funct("foo", {}, false, test(done)); | ||
it( 'should return an error 5', function( done ) { | ||
funct( 'foo', {}, false, test( done ) ); | ||
}); | ||
}; | ||
|
||
var bufferTests = function(testFunction) { | ||
var bufferTests = function( testFunction ) { | ||
|
||
var funct; | ||
|
||
beforeEach(function() { | ||
beforeEach( function() { | ||
funct = testFunction(); | ||
}); | ||
|
||
it('should return an error 1', function(done) { | ||
funct(test(done)); | ||
it( 'should return an error 1', function( done ) { | ||
funct( test( done ) ); | ||
}); | ||
|
||
it('should return an error 2', function(done) { | ||
funct(false, test(done)); | ||
it( 'should return an error 2', function( done ) { | ||
funct( false, test( done ) ); | ||
}); | ||
|
||
it('should return an error 3', function(done) { | ||
funct(test(done), false); | ||
it( 'should return an error 3', function( done ) { | ||
funct( test( done ), false ); | ||
}); | ||
|
||
it('should return an error 4', function(done) { | ||
funct("foo", test(done), false); | ||
it( 'should return an error 4', function( done ) { | ||
funct( 'foo', test( done ), false ); | ||
}); | ||
|
||
it('should return an error 5', function(done) { | ||
funct("foo", {}, false, test(done)); | ||
it( 'should return an error 5', function( done ) { | ||
funct( 'foo', {}, false, test( done ) ); | ||
}); | ||
}; | ||
|
||
describe('when passed incorrect parameters', function() { | ||
|
||
describe("fromFileWithPath", function() { | ||
pathTests(function(){ return global.fromFileWithPath }, false); | ||
describe( 'when passed incorrect parameters', function() { | ||
describe( 'fromFileWithPath', function() { | ||
pathTests( function() { return global.fromFileWithPath; }, false ); | ||
}); | ||
|
||
describe("fromFileWithMimeAndPath", function() { | ||
pathTests(function(){ return global.fromFileWithMimeAndPath }, false); | ||
describe( 'fromFileWithMimeAndPath', function() { | ||
pathTests( function() { return global.fromFileWithMimeAndPath; }, false ); | ||
}); | ||
|
||
describe("fromBufferWithName", function() { | ||
bufferTests(function(){ return global.fromBufferWithName }, false); | ||
describe( 'fromBufferWithName', function() { | ||
bufferTests( function() { return global.fromBufferWithName; }, false ); | ||
}); | ||
|
||
describe("fromBufferWithMime", function() { | ||
bufferTests(function(){ return global.fromBufferWithMime }, false); | ||
describe( 'fromBufferWithMime', function() { | ||
bufferTests( function() { return global.fromBufferWithMime; }, false ); | ||
}); | ||
|
||
}); | ||
}); |