-
Notifications
You must be signed in to change notification settings - Fork 417
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
Frank Schmid
committed
Aug 1, 2017
1 parent
a1b5a24
commit 007a925
Showing
6 changed files
with
387 additions
and
3 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
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,23 @@ | ||
'use strict'; | ||
|
||
/** | ||
* Mock object for glob | ||
*/ | ||
|
||
const sinon = require('sinon'); | ||
|
||
const ZipMock = sandbox => ({ | ||
pipe: sandbox.stub(), | ||
append: sandbox.stub(), | ||
finalize: sandbox.stub(), | ||
on: sandbox.stub() | ||
}); | ||
|
||
module.exports.create = sandbox => { | ||
const zipMock = ZipMock(sandbox); | ||
const mock = { | ||
create: sinon.stub().returns(zipMock), | ||
_zipMock: zipMock | ||
}; | ||
return mock; | ||
}; |
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,32 @@ | ||
'use strict'; | ||
|
||
/** | ||
* Mock object for fs | ||
*/ | ||
|
||
// We need sinon to create persistent stubs that are not cleared with the sandbox | ||
const sinon = require('sinon'); | ||
|
||
const StreamMock = sandbox => ({ | ||
on: sandbox.stub() | ||
}); | ||
|
||
const StatMock = sandbox => ({ | ||
isDirectory: sandbox.stub() | ||
}); | ||
|
||
module.exports.create = sandbox => { | ||
const streamMock = StreamMock(sandbox); | ||
const statMock = StatMock(sandbox); | ||
const fsMock = { | ||
createWriteStream: sinon.stub().returns(streamMock), // Persistent stub | ||
readFileSync: sandbox.stub(), | ||
statSync: sinon.stub().returns(statMock), // Persistent stub | ||
writeFileSync: sandbox.stub(), | ||
|
||
_streamMock: streamMock, | ||
_statMock: statMock | ||
}; | ||
|
||
return fsMock; | ||
}; |
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,13 @@ | ||
'use strict'; | ||
|
||
/** | ||
* Mock object for glob | ||
*/ | ||
|
||
const GlobMock = sandbox => ({ | ||
sync: sandbox.stub() | ||
}); | ||
|
||
module.exports.create = sandbox => { | ||
return GlobMock(sandbox); | ||
}; |
Oops, something went wrong.