aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/actions/warning_test.js
blob: 37be9ee8510dc3e0ac2ac3d820a24c39bafb8938 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
var jsdom = require('mocha-jsdom')
var assert = require('assert')
var freeze = require('deep-freeze-strict')
var path = require('path')

var actions = require(path.join(__dirname, '..', '..', '..', 'ui', 'app', 'actions.js'))
var reducers = require(path.join(__dirname, '..', '..',  '..', 'ui', 'app', 'reducers.js'))

describe('action DISPLAY_WARNING', function() {

  it('sets appState.warning to provided value', function() {
    var initialState = {
      appState: {},
    }
    freeze(initialState)

    const warningText = 'This is a sample warning message'

    const action = actions.displayWarning(warningText)
    const resultingState = reducers(initialState, action)

    assert.equal(resultingState.appState.warning, warningText, 'warning text set')
  });
});