UNPKG

2.74 kBJavaScriptView Raw
1"use strict";
2
3var _recompose = require("recompose");
4
5var _uiReductions = require("./ui-reductions");
6
7test('activatePageLoading', function () {
8 expect((0, _uiReductions.activatePageLoading)({
9 foo: 'foo'
10 })).toEqual({
11 foo: 'foo',
12 isPageLoading: true
13 });
14 expect((0, _recompose.compose)(_uiReductions.activatePageLoading)({
15 foo: 'foo'
16 })).toEqual({
17 foo: 'foo',
18 isPageLoading: true
19 });
20});
21test('deactivatePageLoading', function () {
22 expect((0, _uiReductions.deactivatePageLoading)({
23 foo: 'foo',
24 isPageLoading: true
25 })).toEqual({
26 foo: 'foo'
27 });
28 expect((0, _recompose.compose)(_uiReductions.deactivatePageLoading)({
29 foo: 'foo',
30 isPageLoading: true
31 })).toEqual({
32 foo: 'foo'
33 });
34});
35test('activateComponentLoading', function () {
36 expect((0, _uiReductions.activateComponentLoading)({
37 foo: 'foo'
38 }, undefined)).toEqual({
39 foo: 'foo'
40 });
41 expect((0, _uiReductions.activateComponentLoading)({
42 foo: 'foo'
43 }, 'blep')).toEqual({
44 foo: 'foo',
45 loadingComponents: {
46 blep: true
47 }
48 });
49 expect((0, _uiReductions.activateComponentLoading)({
50 foo: 'foo',
51 loadingComponents: {
52 bar: true
53 }
54 }, 'blep')).toEqual({
55 foo: 'foo',
56 loadingComponents: {
57 bar: true,
58 blep: true
59 }
60 });
61 expect((0, _recompose.compose)((0, _uiReductions.activateComponentLoading)('blep'))({
62 foo: 'foo'
63 })).toEqual({
64 foo: 'foo',
65 loadingComponents: {
66 blep: true
67 }
68 });
69});
70test('deactivateComponentLoading', function () {
71 expect((0, _uiReductions.deactivateComponentLoading)({
72 foo: 'foo',
73 loadingComponents: {
74 blep: true
75 }
76 }, undefined)).toEqual({
77 foo: 'foo',
78 loadingComponents: {
79 blep: true
80 }
81 });
82 expect((0, _uiReductions.deactivateComponentLoading)({
83 foo: 'foo',
84 loadingComponents: {
85 blep: true
86 }
87 }, 'blep')).toEqual({
88 foo: 'foo'
89 });
90 expect((0, _uiReductions.deactivateComponentLoading)({
91 foo: 'foo',
92 loadingComponents: {
93 bar: true,
94 blep: true
95 }
96 }, 'blep')).toEqual({
97 foo: 'foo',
98 loadingComponents: {
99 bar: true
100 }
101 });
102 expect((0, _recompose.compose)((0, _uiReductions.deactivateComponentLoading)('blep'))({
103 foo: 'foo',
104 loadingComponents: {
105 blep: true
106 }
107 })).toEqual({
108 foo: 'foo'
109 });
110});
111test('addOneNotification', function () {
112 expect((0, _uiReductions.addOneNotification)({
113 notifications: []
114 }, 'notif')).toEqual({
115 notifications: [{
116 message: 'notif'
117 }]
118 });
119 expect((0, _recompose.compose)((0, _uiReductions.addOneNotification)('notif'))({
120 notifications: []
121 })).toEqual({
122 notifications: [{
123 message: 'notif'
124 }]
125 });
126});
\No newline at end of file