From 91b320cf35029931cb17cbab44fcab6254e1e1a4 Mon Sep 17 00:00:00 2001 From: Amjad Masad Date: Thu, 23 Apr 2015 11:30:39 -0700 Subject: [PATCH] [react-packager] Fix jest tests --- .../AssetServer/__tests__/AssetServer-test.js | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/react-packager/src/AssetServer/__tests__/AssetServer-test.js b/react-packager/src/AssetServer/__tests__/AssetServer-test.js index 94dba8cf..ba804b5f 100644 --- a/react-packager/src/AssetServer/__tests__/AssetServer-test.js +++ b/react-packager/src/AssetServer/__tests__/AssetServer-test.js @@ -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; });