@hydrogenjs/redux-hydrogen
Advanced tools
Comparing version 0.3.5 to 0.4.0
@@ -6,2 +6,13 @@ # Change Log | ||
<a name="0.4.0"></a> | ||
# [0.4.0](https://github.com/Lemonpeach/redux-hydrogen/compare/v0.3.5...v0.4.0) (2018-06-26) | ||
### Features | ||
* **redux-hydrogen:** handle paginated data ([d959933](https://github.com/Lemonpeach/redux-hydrogen/commit/d959933)) | ||
<a name="0.3.5"></a> | ||
@@ -8,0 +19,0 @@ ## [0.3.5](https://github.com/Lemonpeach/redux-hydrogen/compare/v0.3.4...v0.3.5) (2018-06-16) |
@@ -37,3 +37,3 @@ 'use strict'; | ||
} | ||
var r = [(0, _modifiers.insert)(data), (0, _modifiers.pending)(false)]; | ||
var r = [(0, _modifiers.insert)(data.data || data), (0, _modifiers.pending)(false)]; | ||
if ((0, _actions.isQuery)(type)) { | ||
@@ -40,0 +40,0 @@ r.push((0, _modifiers.queried)(verb, query)); |
{ | ||
"name": "@hydrogenjs/redux-hydrogen", | ||
"version": "0.3.5", | ||
"version": "0.4.0", | ||
"description": "Don't waste your time writing redux boilerplate.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -78,2 +78,19 @@ import { getType, verbs, stages } from 'actions/actions'; | ||
test('handles paginated insert action', () => { | ||
const state = {}; | ||
const { reducer } = require('../data-reducer'); | ||
reducer(state, { | ||
data: { | ||
data: [{ id: 1 }, { id: 2 }], skip: 10, limit: 10, total: 250 | ||
}, | ||
verb: verbs.FIND, | ||
type: getType(verbs.FIND, 'people', stages.FULFILLED) | ||
}); | ||
const { insert, pending } = require('../modifiers'); | ||
expect(insert).toHaveBeenCalledWith([{ id: 1 }, { id: 2 }]); | ||
expect(insert()).toHaveBeenCalledWith(state); | ||
expect(pending).toHaveBeenCalledWith(false); | ||
expect(pending()).toHaveBeenCalledWith(state); | ||
}); | ||
test('handles query insert action', () => { | ||
@@ -80,0 +97,0 @@ const state = {}; |
@@ -22,3 +22,3 @@ import { isPending, isFulfilled, isRejected, isQuery, isRemove, isReset } from 'actions'; | ||
} | ||
const r = [insert(data), pending(false)]; | ||
const r = [insert(data.data || data), pending(false)]; | ||
if (isQuery(type)) { | ||
@@ -25,0 +25,0 @@ r.push(queried(verb, query)); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
61423
1211