-
Notifications
You must be signed in to change notification settings - Fork 710
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix grouping bar for topologies that don't support grouping
- fixes #61 - dont clear nodes cache if topo is the same - combined stores that were interdependent - dont show topology grouping menu if unsupported - also harmonized some variable names - removed old grouping switcher - moved topo actions to app actions, removed search - get correct topology url - first JS test using Jest - make tests run on circle using the build container.
- Loading branch information
Showing
20 changed files
with
260 additions
and
233 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
jest.dontMock('../app-store'); | ||
jest.dontMock('../../constants/action-types'); | ||
|
||
describe('AppStore', function() { | ||
|
||
var ActionTypes = require('../../constants/action-types'); | ||
var AppStore, AppDispatcher, callback; | ||
|
||
// actions | ||
|
||
var ClickTopologyAction = { | ||
type: ActionTypes.CLICK_TOPOLOGY, | ||
topologyId: 'topo1' | ||
}; | ||
|
||
var ClickGroupingAction = { | ||
type: ActionTypes.CLICK_GROUPING, | ||
grouping: 'grouped' | ||
}; | ||
|
||
var ReceiveTopologiesAction = { | ||
type: ActionTypes.RECEIVE_TOPOLOGIES, | ||
topologies: [{ | ||
url: '/topo1', | ||
grouped_url: '/topo1grouped', | ||
name: 'Topo1' | ||
}] | ||
}; | ||
|
||
beforeEach(function() { | ||
AppStore = require('../app-store'); | ||
AppDispatcher = require('../../dispatcher/app-dispatcher'); | ||
callback = AppDispatcher.register.mock.calls[0][0]; | ||
}); | ||
|
||
// topology tests | ||
|
||
it('init with no topologies', function() { | ||
expect(AppDispatcher.register.mock.calls.length).toBe(1); | ||
var topos = AppStore.getTopologies(); | ||
expect(topos.length).toBe(0); | ||
expect(AppStore.getCurrentTopology()).toBeUndefined(); | ||
}); | ||
|
||
it('get current topology', function() { | ||
callback(ClickTopologyAction); | ||
callback(ReceiveTopologiesAction); | ||
|
||
expect(AppStore.getTopologies().length).toBe(1); | ||
expect(AppStore.getCurrentTopology().name).toBe('Topo1'); | ||
expect(AppStore.getCurrentTopologyUrl()).toBe('/topo1'); | ||
}); | ||
|
||
it('get grouped topology', function() { | ||
callback(ClickTopologyAction); | ||
callback(ReceiveTopologiesAction); | ||
callback(ClickGroupingAction); | ||
|
||
expect(AppStore.getTopologies().length).toBe(1); | ||
expect(AppStore.getCurrentTopology().name).toBe('Topo1'); | ||
expect(AppStore.getCurrentTopologyUrl()).toBe('/topo1grouped'); | ||
}); | ||
|
||
|
||
}); |
Oops, something went wrong.