1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2026-04-20 00:17:04 +00:00

refactored out loadFile()

This commit is contained in:
Steven Hugg
2018-06-29 17:44:04 -06:00
parent db11f31464
commit 952dc1b312
3 changed files with 112 additions and 46 deletions
+32
View File
@@ -0,0 +1,32 @@
"use strict";
var vm = require('vm');
var fs = require('fs');
var assert = require('assert');
var includeInThisContext = function(path) {
var code = fs.readFileSync(path);
vm.runInThisContext(code, path);
};
includeInThisContext("localForage/dist/localforage.nopromises.js");
includeInThisContext("src/store.js");
var testplatform = "__TEST__";
var localItems = {};
global.localStorage = {
getItem: function(k) {
return localItems[k];
},
setItem: function(k,v) {
localItems[k] = v;
}
};
describe('Store', function() {
it('Should create persistent store', function() {
var store = createNewPersistentStore(testplatform);
// TODO
});
});