8bitworkshop/test/cli/teststore.js

33 lines
668 B
JavaScript
Raw Normal View History

2018-06-29 23:44:04 +00:00
"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
});
});