fleet/frontend/redux/nodes/persistent_flash/reducer.tests.js
Mike Stone e565e03130 License features (#1134)
* API client to create and get an app license

* Fixes unhandled promise rejection errors in redux config

* License Page and Form

* Adds getLicense action

* Adds License key area to App Settings Form

* Use license.token instead of license.license

* Implement API client

* Adds key icon to License Form

* Adds License Success component

* Render License Success on License Page when there is a license

* Adds persistent flash actions and reducer to redux

* Adds nag message middleware

* Moves FlashMessage component to flash_message directory

* Adds Persistent Flash component

* Renders Persistent Flash component from Core Layout

* Adds Kyle's styles

* Change license validation message

* Finishing touches for app config form license area

* Handle revoked licenses

* License Page hits setup endpoint

* Display server errors on license form

* Changes 0 allowed hosts to unlimited

* Trims JWT token before sending to the server

* GET setup page after submitting license
2017-02-09 22:16:51 -05:00

33 lines
1004 B
JavaScript

import expect from 'expect';
import actions from 'redux/nodes/persistent_flash/actions';
import reducer, { initialState } from 'redux/nodes/persistent_flash/reducer';
describe('persistent_flash - reducer', () => {
it('sets the initial state', () => {
const nextState = reducer(undefined, { type: 'SOME_ACTION' });
expect(nextState).toEqual(initialState);
});
it('shows the flash and sets the message when showPersistentFlash is dispatched', () => {
const message = 'This is the flash message';
const action = actions.showPersistentFlash(message);
expect(reducer(initialState, action)).toEqual({
showFlash: true,
message,
});
});
it('hides the flash and removes the message when hidePersistentFlash is dispatched', () => {
const currentState = { showFlash: true, message: 'something' };
const action = actions.hidePersistentFlash;
expect(reducer(currentState, action)).toEqual({
showFlash: false,
message: '',
});
});
});