Skip to content

Instantly share code, notes, and snippets.

@persocon
Created June 21, 2016 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save persocon/edbf7cd195d9830ce178888162a4e7a2 to your computer and use it in GitHub Desktop.
Save persocon/edbf7cd195d9830ce178888162a4e7a2 to your computer and use it in GitHub Desktop.
it('should fill in GET_OPTIONS when fetching all options is done', function(done) {
const server = sinon.fakeServer.create();
server.respondWith('GET', '/api/selectActivity/2/tkrp1986',[
200,
{ "Content-Type": "application/json" },
'{options: [{value: "nightfall"}]}'
]);
const expectedAction = {
type: 'GET_OPTIONS',
options: [
{
value: "nightfall"
}
]
};
const store = mockStore({ user: userLoggedIn }, expectedAction, done);
store.dispatch(actions.getOptions(apiUrl))
.then(function() {
expect(store.getActions()[0]).should.equal(expectedAction);
done();
});
server.respond();
server.restore();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment