Closed geoffharcourt closed 8 years ago
That would be cool. What would you return? Just the display name/id?
Just the name of the store if that kind of introspection is possible. Currently if you reference a store or set of action creators in a Jasmine test by object rather than as a string of the name, the subject of the test is a function. You can fix it by adding a toString
method to each store or action creator set, but that is annoying.
Returning the "Store - id: 1023" might be better, if deeper introspection isn't possible, as it points to the object needing its own implementation of toString()
.
Yeah, I can see that being useful. Go for it :+1: You'd need to work against the v0.9 branch as we've stopped all non-critical work on Marty v0.8 branch (whats on master). I'm hoping to release v0.9 next wednesday (Currently waiting on react-router v0.13 being released).
It's also worth noting that in v0.9 everything needs an id
which is a human readable identifier for that type. It's pretty much identical to displayName
except it must be unique within the application domain so you should probably do something like
toString() {
return `${this.displayName || this.id} (${this.__id})`;
}
I'm happy to do this PR if it would be accepted in principle. I want to implement
toString
on Stores so that when they are referenced in application tests they can have their names properly rendered.