mirror of
https://github.com/EDCD/coriolis.git
synced 2025-12-09 22:55:35 +00:00
2.0.1 Beta
This commit is contained in:
@@ -4,32 +4,103 @@ import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import TU from 'react-testutils-additions';
|
||||
|
||||
xdescribe('Persist', function() {
|
||||
let origAddEventListener = window.addEventListener;
|
||||
let storageListener;
|
||||
let ls = {};
|
||||
|
||||
const Persist = require('../src/app/stores/Persist').default;
|
||||
// Implment mock localStorage
|
||||
let localStorage = {
|
||||
getItem: function(key) {
|
||||
return ls[key];
|
||||
},
|
||||
setItem: function(key, value) {
|
||||
ls[key] = value;
|
||||
},
|
||||
removeItem: function(key) {
|
||||
delete ls[key];
|
||||
},
|
||||
clear: function() {
|
||||
ls = {};
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener = function(eventName, listener) {
|
||||
|
||||
if(eventName == 'storage') {
|
||||
storageListener = listener; // Keep track of latest storage listener
|
||||
} else {
|
||||
origAddEventListener.apply(arguments);
|
||||
}
|
||||
}
|
||||
|
||||
describe('Persist', function() {
|
||||
|
||||
const Persist = require('../src/app/stores/Persist').Persist;
|
||||
|
||||
describe('Builds', function() {
|
||||
it("loads from localStorage correctly", function() {
|
||||
|
||||
});
|
||||
|
||||
it("can save a build", function() {
|
||||
|
||||
});
|
||||
|
||||
it("can delete a build", function() {
|
||||
|
||||
});
|
||||
|
||||
it("works without localStorage", function() {
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
describe('Comparisons', function() {
|
||||
it("loads from localStorage correctly", function() {
|
||||
|
||||
});
|
||||
|
||||
it("works without localStorage", function() {
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
describe('Settings', function() {
|
||||
describe('Multi tab/window', function() {
|
||||
it.only("syncs builds", function() {
|
||||
window.localStorage = localStorage;
|
||||
|
||||
it("has defaults", function() {
|
||||
expect(false).toBeTruthy('Implement');
|
||||
let p = new Persist();
|
||||
let newBuilds = {};
|
||||
|
||||
storageListener({ key: 'builds', newValue: JSON.stringify(newBuilds) });
|
||||
});
|
||||
});
|
||||
|
||||
describe('General and Settings', function() {
|
||||
it.only("has defaults", function() {
|
||||
let p = new Persist();
|
||||
expect(p.getLangCode()).toBe('en');
|
||||
expect(p.showTooltips()).toBe(true);
|
||||
expect(p.getInsurance()).toBe('standard');
|
||||
expect(p.getShipDiscount()).toBe(1);
|
||||
expect(p.getModuleDiscount()).toBe(1);
|
||||
expect(p.getSizeRatio()).toBe(1);
|
||||
});
|
||||
|
||||
it("loads from localStorage correctly", function() {
|
||||
expect(false).toBeTruthy('Implement');
|
||||
expect(false).toBeTruthy('TODO: Implement');
|
||||
});
|
||||
|
||||
it("uses defaults from a corrupted localStorage", function() {
|
||||
expect(false).toBeTruthy('TODO: Implement');
|
||||
});
|
||||
|
||||
it("works without localStorage", function() {
|
||||
|
||||
});
|
||||
|
||||
it("generates the backup", function() {
|
||||
expect(false).toBeTruthy('Implement');
|
||||
expect(false).toBeTruthy('TODO: Implement');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user