Skip to content

Instantly share code, notes, and snippets.

@faisal00813
Created May 13, 2017 09:54
Show Gist options
  • Save faisal00813/7700453da95d08884a1ce01a50c50574 to your computer and use it in GitHub Desktop.
Save faisal00813/7700453da95d08884a1ce01a50c50574 to your computer and use it in GitHub Desktop.
import thunk from 'redux-thunk';
import expect from 'expect';
describe('actions test', () => {
beforeAll(() => {
// do something here which you want to be executed before first test runs
}
it('editor.newPatient() should create a new patient', (done) => {
const dispatch = expect.createSpy();
const patient = {
_id: new Date().getTime() + '_' + "" + '_' + "",
type: "hosp_patient",
visitedOn: new Date().getTime(),
mobile:"XXXXXXXXXXXXX",
firstName:"YYYYY"
};
editor.newPatient(patient,db)(dispatch).then(()=>{
expect(dispatch.calls[1].arguments[0].type).toBe('START_NEW_ACCOUNT');
done();
}).catch((err)=>{
console.log(err);
done();
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment