UNPKG

1.13 kBJavaScriptView Raw
1"use strict";
2
3var _recompose = require("recompose");
4
5var _dataReductions = require("./data-reductions");
6
7test('addData', function () {
8 var dataState = {
9 foo: 'foo'
10 };
11 expect((0, _dataReductions.addData)(dataState, {
12 bar: 'bar'
13 })).toEqual({
14 foo: 'foo',
15 bar: 'bar'
16 });
17 expect((0, _recompose.compose)((0, _dataReductions.addData)({
18 bar: 'bar'
19 }))(dataState)).toEqual({
20 foo: 'foo',
21 bar: 'bar'
22 });
23});
24test('delData', function () {
25 var dataState = {
26 foo: 'foo'
27 };
28 expect(function () {
29 return (0, _dataReductions.delData)();
30 }).toThrow();
31 expect(function () {
32 return (0, _dataReductions.delData)(1);
33 }).toThrow();
34 expect((0, _dataReductions.delData)('foo')(dataState)).toEqual({});
35 expect((0, _recompose.compose)((0, _dataReductions.delData)('foo'))(dataState)).toEqual({});
36});
37test('clearData', function () {
38 var dataState = {
39 foo: 'foo'
40 };
41 expect((0, _dataReductions.clearData)()).toEqual({});
42 expect((0, _dataReductions.clearData)(dataState)).toEqual({});
43 expect((0, _recompose.compose)(_dataReductions.clearData)(dataState)).toEqual({});
44});
\No newline at end of file