Skip to content

Instantly share code, notes, and snippets.

@pechitook
Last active December 29, 2017 00:16
Show Gist options
  • Save pechitook/1eb6bb67fc578128c29713aad483b522 to your computer and use it in GitHub Desktop.
Save pechitook/1eb6bb67fc578128c29713aad483b522 to your computer and use it in GitHub Desktop.
import Store from 'test/Store'; // El store re piola que hicimos
describe('Shows modal', () => {
beforeEach(() => {
// inicializamos nuestro store
store = new Store();
// Disparamos acciones necesarias para poder tener los datos
return store.dispatch(loadPost(POST_ID)).then(() => {
// Limpiamos el log para poder tener asserts más limpitos
store.clearActions();
});
});
it('dispatches an OPEN_SHARE_DIALOG action', () => {
// Disparamos un action que hace un par de cosas async para chequear si puede
// o no compartir el post, e internamente dispara un OPEN_SHARE_DIALOG action.
return store.dispatch(actions.showShareDialog()).then(() => {
// store.getActions es un array con todas las acciones que se han disparado, y lo
// podemos usar para corroborar que se han disparado las acciones que queríamos.
expect(store.getActions()).toContainEqual({ type: 'OPEN_SHARE_DIALOG' });
});
});
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment