mirror of
https://github.com/weaveworks/scope.git
synced 2026-07-19 05:19:35 +00:00
fixed action name typo and added test
This commit is contained in:
@@ -4,13 +4,13 @@ module.exports = keymirror({
|
||||
CLICK_CLOSE_DETAILS: null,
|
||||
CLICK_NODE: null,
|
||||
CLICK_TOPOLOGY: null,
|
||||
OPEN_WEBSOCKER: null,
|
||||
CLOSE_WEBSOCKET: null,
|
||||
ENTER_EDGE: null,
|
||||
ENTER_NODE: null,
|
||||
HIT_ESC_KEY: null,
|
||||
LEAVE_EDGE: null,
|
||||
LEAVE_NODE: null,
|
||||
OPEN_WEBSOCKET: null,
|
||||
RECEIVE_NODE_DETAILS: null,
|
||||
RECEIVE_NODES: null,
|
||||
RECEIVE_NODES_DELTA: null,
|
||||
|
||||
@@ -39,6 +39,10 @@ describe('AppStore', function() {
|
||||
type: ActionTypes.HIT_ESC_KEY
|
||||
};
|
||||
|
||||
const OpenWebsocketAction = {
|
||||
type: ActionTypes.OPEN_WEBSOCKET
|
||||
};
|
||||
|
||||
const ReceiveEmptyNodesDeltaAction = {
|
||||
type: ActionTypes.RECEIVE_NODES_DELTA,
|
||||
delta: {}
|
||||
@@ -170,6 +174,9 @@ describe('AppStore', function() {
|
||||
expect(AppStore.isWebsocketClosed()).toBeTruthy();
|
||||
expect(AppStore.getNodes()).toEqual(NODE_SET);
|
||||
|
||||
registeredCallback(OpenWebsocketAction);
|
||||
expect(AppStore.isWebsocketClosed()).toBeFalsy();
|
||||
|
||||
registeredCallback(ReceiveEmptyNodesDeltaAction);
|
||||
expect(AppStore.getNodes()).toEqual({});
|
||||
});
|
||||
|
||||
@@ -157,11 +157,6 @@ AppStore.registeredCallback = function(payload) {
|
||||
AppStore.emit(AppStore.CHANGE_EVENT);
|
||||
break;
|
||||
|
||||
case ActionTypes.OPEN_WEBSOCKET:
|
||||
websocketClosed = false;
|
||||
AppStore.emit(AppStore.CHANGE_EVENT);
|
||||
break;
|
||||
|
||||
case ActionTypes.CLOSE_WEBSOCKET:
|
||||
websocketClosed = true;
|
||||
AppStore.emit(AppStore.CHANGE_EVENT);
|
||||
@@ -193,6 +188,14 @@ AppStore.registeredCallback = function(payload) {
|
||||
AppStore.emit(AppStore.CHANGE_EVENT);
|
||||
break;
|
||||
|
||||
case ActionTypes.OPEN_WEBSOCKET:
|
||||
// flush nodes cache after re-connect
|
||||
nodes = {};
|
||||
websocketClosed = false;
|
||||
|
||||
AppStore.emit(AppStore.CHANGE_EVENT);
|
||||
break;
|
||||
|
||||
case ActionTypes.RECEIVE_ERROR:
|
||||
errorUrl = payload.errorUrl;
|
||||
AppStore.emit(AppStore.CHANGE_EVENT);
|
||||
@@ -212,12 +215,6 @@ AppStore.registeredCallback = function(payload) {
|
||||
|
||||
errorUrl = null;
|
||||
|
||||
// flush nodes cache after re-connect
|
||||
if (websocketClosed) {
|
||||
nodes = {};
|
||||
}
|
||||
websocketClosed = false;
|
||||
|
||||
// nodes that no longer exist
|
||||
_.each(payload.delta.remove, function(nodeId) {
|
||||
// in case node disappears before mouseleave event
|
||||
|
||||
Reference in New Issue
Block a user