Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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