-
Notifications
You must be signed in to change notification settings - Fork 6
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
paulsouche
committed
Sep 15, 2014
1 parent
b98a2a4
commit 0397fc9
Showing
9 changed files
with
219 additions
and
142 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,3 +1,4 @@ | ||
node_modules/ | ||
Debug/ | ||
Release/ | ||
Release/ | ||
.idea/ |
Large diffs are not rendered by default.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
//Mock file to pass test | ||
/*jslint node: true */ | ||
'use strict'; | ||
|
||
exports.goScan = function() { | ||
console.log('OMG IT WORKS'); | ||
}; |
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
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
describe('twainDll',function() { | ||
'use strict'; | ||
|
||
var TwainDll = require('../../twainDll').TwainDll, | ||
scanDll = new TwainDll(); | ||
|
||
beforeEach(function() { | ||
//here is the function call | ||
scanDll.goScan(); | ||
}); | ||
|
||
it('should do the amazing',function() { | ||
expect(1 + 1).toBe(2); | ||
}); | ||
|
||
}); |
Empty file.
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,11 +1,78 @@ | ||
describe('twainDll',function() { | ||
'use strict'; | ||
|
||
var twainDll = require('../../twainDll'); | ||
var proxyquire = require('proxyquire'),module,mockUtil,mockBinding,mockEvents,mockStream; | ||
|
||
it('should return a function',function() { | ||
expect(typeof twainDll).toBe('function'); | ||
beforeEach(function() { | ||
mockEvents = { | ||
EventEmitter: {foo:'bar'} | ||
}; | ||
mockStream = { | ||
Stream: {foo:'bar'} | ||
}; | ||
mockUtil = jasmine.createSpyObj('util',['inherits']); | ||
mockBinding = jasmine.createSpyObj('binding',['goScan']); | ||
module = proxyquire('../../twainDll', { | ||
'./build/twainDll.node': mockBinding, | ||
'events': mockEvents, | ||
'stream': mockStream, | ||
'util': mockUtil | ||
}); | ||
}); | ||
|
||
it('should return an instance of TwainDllFactory',function() { | ||
expect(typeof module).toBe('object'); | ||
expect(module.constructor.name).toBe('TwainDllFactory'); | ||
}); | ||
|
||
it('should inherits from events',function() { | ||
expect(mockUtil.inherits).toHaveBeenCalledWith(module.constructor,mockEvents.EventEmitter); | ||
}); | ||
|
||
it('should provide the binding',function() { | ||
expect(module.binding).toBe(mockBinding); | ||
}); | ||
|
||
describe('TwainDllConstructor', function() { | ||
|
||
it('should provide a TwainDll constructor',function() { | ||
expect(typeof module.TwainDll).toBe('function'); | ||
}); | ||
|
||
it('should inherits from stream',function() { | ||
expect(mockUtil.inherits).toHaveBeenCalledWith(module.TwainDll,mockStream.Stream); | ||
}); | ||
|
||
describe('Instance', function() { | ||
var scanObj; | ||
|
||
beforeEach(function() { | ||
scanObj = new module.TwainDll(); | ||
}); | ||
|
||
it('should create an instance of TwainDll',function() { | ||
expect(typeof scanObj).toBe('object'); | ||
expect(scanObj.constructor.name).toBe('TwainDll'); | ||
}); | ||
|
||
it('should provide the api',function() { | ||
expect(typeof scanObj.goScan).toBe('function'); | ||
}); | ||
|
||
describe('goScan',function() { | ||
|
||
beforeEach(function() { | ||
scanObj.goScan(); | ||
}); | ||
|
||
it('should call the binding',function() { | ||
expect(mockBinding.goScan).toHaveBeenCalled(); | ||
}); | ||
|
||
}); | ||
|
||
}); | ||
|
||
}); | ||
|
||
}); |
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