1 | "use strict";
|
2 |
|
3 | var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
4 |
|
5 | var _compose = _interopRequireDefault(require("recompose/compose"));
|
6 |
|
7 | var _asyncMapReductions = require("./async-map-reductions");
|
8 |
|
9 | test('asyncMapSetTrueReduction', function () {
|
10 | expect((0, _asyncMapReductions.asyncMapSetTrueReduction)('a')({})).toEqual({
|
11 | a: true
|
12 | });
|
13 | expect((0, _compose.default)((0, _asyncMapReductions.asyncMapSetTrueReduction)('a'))({})).toEqual({
|
14 | a: true
|
15 | });
|
16 | });
|
17 | test('asyncMapSetPageTrueReduction', function () {
|
18 | expect((0, _asyncMapReductions.asyncMapSetPageTrueReduction)()({})).toEqual({
|
19 | page: true
|
20 | });
|
21 | expect((0, _compose.default)((0, _asyncMapReductions.asyncMapSetPageTrueReduction)())({})).toEqual({
|
22 | page: true
|
23 | });
|
24 | });
|
25 | test('asyncMapSetTrueReductionFromAsyncKeyProp', function () {
|
26 | expect((0, _asyncMapReductions.asyncMapSetTrueReductionFromAsyncKeyProp)({
|
27 | asyncKey: 'a'
|
28 | })({})).toEqual({
|
29 | a: true
|
30 | });
|
31 | expect((0, _compose.default)((0, _asyncMapReductions.asyncMapSetTrueReductionFromAsyncKeyProp)({
|
32 | asyncKey: 'a'
|
33 | }))({})).toEqual({
|
34 | a: true
|
35 | });
|
36 | });
|
37 | test('asyncMapSetRequestReduction', function () {
|
38 | expect((0, _asyncMapReductions.asyncMapSetRequestReduction)('a')({})).toEqual({
|
39 | a: _asyncMapReductions.REQUEST
|
40 | });
|
41 | expect((0, _compose.default)((0, _asyncMapReductions.asyncMapSetRequestReduction)('a'))({})).toEqual({
|
42 | a: _asyncMapReductions.REQUEST
|
43 | });
|
44 | });
|
45 | test('asyncMapSetRequestReductionFromAsyncKeyProp', function () {
|
46 | expect((0, _asyncMapReductions.asyncMapSetRequestReductionFromAsyncKeyProp)({
|
47 | asyncKey: 'a'
|
48 | })({})).toEqual({
|
49 | a: _asyncMapReductions.REQUEST
|
50 | });
|
51 | expect((0, _compose.default)((0, _asyncMapReductions.asyncMapSetRequestReductionFromAsyncKeyProp)({
|
52 | asyncKey: 'a'
|
53 | }))({})).toEqual({
|
54 | a: _asyncMapReductions.REQUEST
|
55 | });
|
56 | });
|
57 | test('asyncMapSetSuccessReduction', function () {
|
58 | expect((0, _asyncMapReductions.asyncMapSetSuccessReduction)('a')({})).toEqual({
|
59 | a: _asyncMapReductions.SUCCESS
|
60 | });
|
61 | expect((0, _compose.default)((0, _asyncMapReductions.asyncMapSetSuccessReduction)('a'))({})).toEqual({
|
62 | a: _asyncMapReductions.SUCCESS
|
63 | });
|
64 | });
|
65 | test('asyncMapSetSuccessReductionFromAsyncKeyProp', function () {
|
66 | expect((0, _asyncMapReductions.asyncMapSetSuccessReductionFromAsyncKeyProp)({
|
67 | asyncKey: 'a'
|
68 | })({})).toEqual({
|
69 | a: _asyncMapReductions.SUCCESS
|
70 | });
|
71 | expect((0, _compose.default)((0, _asyncMapReductions.asyncMapSetSuccessReductionFromAsyncKeyProp)({
|
72 | asyncKey: 'a'
|
73 | }))({})).toEqual({
|
74 | a: _asyncMapReductions.SUCCESS
|
75 | });
|
76 | });
|
77 | test('asyncMapSetFailureReduction', function () {
|
78 | expect((0, _asyncMapReductions.asyncMapSetFailureReduction)('a')({})).toEqual({
|
79 | a: _asyncMapReductions.FAILURE
|
80 | });
|
81 | expect((0, _compose.default)((0, _asyncMapReductions.asyncMapSetFailureReduction)('a'))({})).toEqual({
|
82 | a: _asyncMapReductions.FAILURE
|
83 | });
|
84 | });
|
85 | test('asyncMapSetFailureReductionFromAsyncKeyProp', function () {
|
86 | expect((0, _asyncMapReductions.asyncMapSetFailureReductionFromAsyncKeyProp)({
|
87 | asyncKey: 'a'
|
88 | })({})).toEqual({
|
89 | a: _asyncMapReductions.FAILURE
|
90 | });
|
91 | expect((0, _compose.default)((0, _asyncMapReductions.asyncMapSetFailureReductionFromAsyncKeyProp)({
|
92 | asyncKey: 'a'
|
93 | }))({})).toEqual({
|
94 | a: _asyncMapReductions.FAILURE
|
95 | });
|
96 | });
|
97 | test('asyncMapSetCustomReductionFromProps', function () {
|
98 | expect((0, _asyncMapReductions.asyncMapSetCustomReductionFromProps)({
|
99 | asyncKey: 'a',
|
100 | asyncValue: 'custom'
|
101 | })({})).toEqual({
|
102 | a: 'custom'
|
103 | });
|
104 | expect((0, _compose.default)((0, _asyncMapReductions.asyncMapSetCustomReductionFromProps)({
|
105 | asyncKey: 'a',
|
106 | asyncValue: 'custom'
|
107 | }))({})).toEqual({
|
108 | a: 'custom'
|
109 | });
|
110 | });
|
111 | test('asyncMapDeleteReduction', function () {
|
112 | var s = {
|
113 | foo: 'foo',
|
114 | bar: 'bar'
|
115 | };
|
116 | expect((0, _asyncMapReductions.asyncMapDeleteReduction)('foo')(s)).toEqual({
|
117 | bar: 'bar'
|
118 | });
|
119 | expect((0, _compose.default)((0, _asyncMapReductions.asyncMapDeleteReduction)('foo'))(s)).toEqual({
|
120 | bar: 'bar'
|
121 | });
|
122 | });
|
123 | test('asyncMapDeletePageReduction', function () {
|
124 | var s = {
|
125 | page: 'page',
|
126 | bar: 'bar'
|
127 | };
|
128 | expect((0, _asyncMapReductions.asyncMapDeletePageReduction)()(s)).toEqual({
|
129 | bar: 'bar'
|
130 | });
|
131 | expect((0, _compose.default)((0, _asyncMapReductions.asyncMapDeletePageReduction)())(s)).toEqual({
|
132 | bar: 'bar'
|
133 | });
|
134 | });
|
135 | test('asyncMapDeleteReductionFromAsyncKeyProp', function () {
|
136 | var s = {
|
137 | foo: 'foo',
|
138 | bar: 'bar'
|
139 | };
|
140 | expect((0, _asyncMapReductions.asyncMapDeleteReductionFromAsyncKeyProp)({
|
141 | asyncKey: 'foo'
|
142 | })(s)).toEqual({
|
143 | bar: 'bar'
|
144 | });
|
145 | expect((0, _compose.default)((0, _asyncMapReductions.asyncMapDeleteReductionFromAsyncKeyProp)({
|
146 | asyncKey: 'foo'
|
147 | }))(s)).toEqual({
|
148 | bar: 'bar'
|
149 | });
|
150 | });
|
151 | test('asyncMapClearExceptPageReduction', function () {
|
152 | var s = {
|
153 | page: 'page',
|
154 | foo: 'foo'
|
155 | };
|
156 | expect((0, _asyncMapReductions.asyncMapClearExceptPageReduction)()(s)).toEqual({
|
157 | page: 'page'
|
158 | });
|
159 | expect((0, _compose.default)((0, _asyncMapReductions.asyncMapClearExceptPageReduction)())(s)).toEqual({
|
160 | page: 'page'
|
161 | });
|
162 | }); |
\ | No newline at end of file |