Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ const hasProperties = curry((propertyTypes, object) => {
type,
required = false
} = propertyType
if (!required) return true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this changes everything that's not required into an any type, this means you can put anything in a non-required field and it's valid. instead i think we should check if it's not required and you put a nil value, it's good.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh good thought @ahdinosaur - of course - will look at this again 🎉

const objectValue = object[propertyName]
const isType = type(objectValue)
return isType
Expand Down Expand Up @@ -309,7 +310,7 @@ function createReduxConnector (options) {

const reduxConnector = connectRedux(
function mapStateToProps (state, props) {
// use the original props passed into the top-level
// use the original props passed into the top-level
const selected = selector(state, props.ownProps)
// use react state handlers
const querys = getQuerys(state, props)
Expand Down Expand Up @@ -405,4 +406,3 @@ function createFeathersConnector (options) {

return feathersConnector
}

17 changes: 17 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,20 @@ import { connect } from '../'
test('feathers-action-react', function (t) {
t.is(typeof connect, 'function', 'connect is a function')
})

test('options.query can be a single query object', function (t) {
const result = connect({
selector: () => null,
actions: {
dogs: {
test: () => null
}
},
query: {
service: 'dogs'
}
})

// TODO: IK: not really a sufficient test
t.is(typeof result, 'function', 'result of connect is a function')
})