[react-packager] Fix jest tests

This commit is contained in:
Amjad Masad 2015-04-23 11:30:39 -07:00
parent 240424714e
commit 91b320cf35
1 changed files with 14 additions and 7 deletions

View File

@ -1,16 +1,23 @@
'use strict';
jest
.autoMockOff()
.mock('../../lib/declareOpts')
.mock('crypto')
.mock('fs');
.dontMock('path')
.dontMock('../../lib/getAssetDataFromName')
.dontMock('../');
var fs = require('fs');
var AssetServer = require('../');
var Promise = require('bluebird');
describe('AssetServer', function() {
var AssetServer;
var crypto;
var fs;
beforeEach(function() {
AssetServer = require('../');
crypto = require('crypto');
fs = require('fs');
});
describe('assetServer.get', function() {
pit('should work for the simple case', function() {
var server = new AssetServer({
@ -96,7 +103,7 @@ describe('AssetServer', function() {
hash.digest.mockImpl(function() {
return 'wow such hash';
});
require('crypto').createHash.mockImpl(function() {
crypto.createHash.mockImpl(function() {
return hash;
});