diff --git a/test/index.html b/test/index.html
index f755dc486..0a0d77852 100644
--- a/test/index.html
+++ b/test/index.html
@@ -20,13 +20,11 @@
-
+
-
diff --git a/test/test.LocalEncrypted.js b/test/test.LocalEncrypted.js
index 629f6026e..5fcd6068c 100644
--- a/test/test.LocalEncrypted.js
+++ b/test/test.LocalEncrypted.js
@@ -1,7 +1,7 @@
'use strict';
+var copay = copay || require('../copay');
var chai = chai || require('chai');
var should = chai.should();
-var copay = require('../copay');
var LocalEncrypted = copay.StorageLocalEncrypted;
diff --git a/test/test.storage.File.js b/test/test.storage.File.js
index b008af350..38e5789f1 100644
--- a/test/test.storage.File.js
+++ b/test/test.storage.File.js
@@ -9,26 +9,29 @@ var CryptoJS = require('node-cryptojs-aes').CryptoJS;
var mock = require('mock-fs');
-
describe('Storage/File', function() {
it('should exist', function() {
should.exist(Storage);
});
- var obj = {
- "test": "test"
+ var mockFS = function() {
+ var obj = {
+ "test": "test"
+ };
+ var encryptedStr = CryptoJS.AES.encrypt(JSON.stringify(obj), 'password').toString();
+ mock({
+ 'myfilename': encryptedStr
+ });
};
- var encryptedStr = CryptoJS.AES.encrypt(JSON.stringify(obj), 'password').toString();
- mock({
- 'myfilename': encryptedStr
- });
describe('#load', function(done) {
it('should call fs.readFile', function(done) {
+ mockFS();
var storage = new Storage({
password: 'password'
});
storage.load('myfilename', function(err) {
+ mock.restore();
done();
});
});
@@ -36,6 +39,7 @@ describe('Storage/File', function() {
describe('#save', function(done) {
it('should call fs.writeFile', function(done) {
+ mockFS();
var storage = new Storage({
password: 'password'
});
diff --git a/util/build.js b/util/build.js
index b64a690e8..8c74c7268 100644
--- a/util/build.js
+++ b/util/build.js
@@ -44,30 +44,6 @@ var createBundle = function(opts) {
b.require('./js/models/core/Wallet', {
expose: '../../js/models/core/Wallet'
});
- b.require('./test/mocks/FakeStorage', {
- expose: './mocks/FakeStorage'
- });
- b.require('./test/mocks/FakeLocalStorage', {
- expose: './mocks/FakeLocalStorage'
- });
- b.require('./js/models/core/Message', {
- expose: '../js/models/core/Message'
- });
- b.require('./test/mocks/FakeBlockchain', {
- expose: './mocks/FakeBlockchain'
- });
- b.require('./test/mocks/FakeNetwork', {
- expose: './mocks/FakeNetwork'
- });
- b.require('./test/mocks/FakePayProServer', {
- expose: './mocks/FakePayProServer'
- });
- b.require('./test/mocks/FakePayProServer', {
- expose: '../../mocks/FakePayProServer'
- });
- b.require('./test/mocks/FakeBuilder', {
- expose: './mocks/FakeBuilder'
- });
b.require('./js/models/network/WebRTC', {
expose: '../js/models/network/WebRTC'
});
@@ -94,7 +70,30 @@ var createBundle = function(opts) {
//include dev dependencies
b.require('sinon');
b.require('blanket');
- b.require('soop');
+ b.require('./test/mocks/FakeStorage', {
+ expose: './mocks/FakeStorage'
+ });
+ b.require('./test/mocks/FakeLocalStorage', {
+ expose: './mocks/FakeLocalStorage'
+ });
+ b.require('./js/models/core/Message', {
+ expose: '../js/models/core/Message'
+ });
+ b.require('./test/mocks/FakeBlockchain', {
+ expose: './mocks/FakeBlockchain'
+ });
+ b.require('./test/mocks/FakeNetwork', {
+ expose: './mocks/FakeNetwork'
+ });
+ b.require('./test/mocks/FakePayProServer', {
+ expose: './mocks/FakePayProServer'
+ });
+ b.require('./test/mocks/FakePayProServer', {
+ expose: '../../mocks/FakePayProServer'
+ });
+ b.require('./test/mocks/FakeBuilder', {
+ expose: './mocks/FakeBuilder'
+ });
}
if (!opts.dontminify) {