Inline cache mock for DependencyGraph-test
Reviewed By: davidaurelio Differential Revision: D2629211 fb-gh-sync-id: ade0bf4e486b58ecbc9a29eb3bdb61286eebb3d5
This commit is contained in:
parent
44b051d98d
commit
666706b0da
|
@ -8,6 +8,4 @@
|
|||
*/
|
||||
'use strict';
|
||||
|
||||
module.exports = function() {
|
||||
return function() {};
|
||||
};
|
||||
module.exports = () => () => {};
|
||||
|
|
|
@ -13,11 +13,8 @@ jest.autoMockOff();
|
|||
const Promise = require('promise');
|
||||
|
||||
jest
|
||||
.mock('fs')
|
||||
.mock('../../../Cache')
|
||||
.mock('../../../Activity');
|
||||
.mock('fs');
|
||||
|
||||
var Cache = require('../../../Cache');
|
||||
var DependencyGraph = require('../index');
|
||||
var fs = require('fs');
|
||||
|
||||
|
@ -51,6 +48,13 @@ describe('DependencyGraph', function() {
|
|||
isWatchman: () => Promise.resolve(false),
|
||||
};
|
||||
|
||||
const Cache = jest.genMockFn();
|
||||
Cache.prototype.get = jest.genMockFn().mockImplementation(
|
||||
(filepath, field, cb) => cb(filepath)
|
||||
);
|
||||
Cache.prototype.invalidate = jest.genMockFn();
|
||||
Cache.prototype.end = jest.genMockFn();
|
||||
|
||||
defaults = {
|
||||
assetExts: ['png', 'jpg'],
|
||||
cache: new Cache(),
|
||||
|
|
|
@ -42,7 +42,7 @@ class DependencyGraph {
|
|||
this._opts = {
|
||||
activity: activity || defaultActivity,
|
||||
roots,
|
||||
ignoreFilePath: ignoreFilePath || () => {},
|
||||
ignoreFilePath: ignoreFilePath || (() => {}),
|
||||
fileWatcher,
|
||||
assetRoots_DEPRECATED: assetRoots_DEPRECATED || [],
|
||||
assetExts,
|
||||
|
|
Loading…
Reference in New Issue