-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
testing stores #188
Comments
Hey, there are a couple of strategies you could try 1) Stub sinon.stub(SomeStateSource, "request").returns(Promise.resolve({
body: {
foo: { bar: "baz" }
}
}) 2) Uses sinon's var expectedState = { bar: "baz" };
var server = sinon.fakeServer.create();
server.respondWith(
"GET",
"/foo",
[200, { "Content-Type": "application/json" }, JSON.stringify(expectedState)]
);
FooStore.getFoo();
server.respond();
expect(FooStore.getFoo().result).to.eql(expectedState); While a bit more complicated I prefer using |
thanks, I've been trying to work with those but still in the fog. I've also been messing around with using sequence diagrams generated from http://bramp.github.io/js-sequence-diagrams/ but it struck me this would be really effective at the live, instrumented level. Have you considered that? |
Thats a cool idea. I'd like to do something like that in the devtools but its just finding the time.... |
I want to test interaction with my stores (not the rest of components) at an integration level. I can't figure out how to mock or get around the HTTP state source's dependency on browser fetch. Is there any way to mock just this part of a test? Can Marty recognize it's not running in a browser and use an alternate fetch mechanism?
I see a discussion at #115 but there's no complete answer. I have tried mocking an HttpAPI instance without success and it's taking me off the supported path. Knowing 0.9 supports server rendering I'm wondering if there's a way to do this today.
Thanks!
The text was updated successfully, but these errors were encountered: