Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- t.test('--Scenario: save error (stubbed) [failure]', function (st) {
- st.plan(1);
- const userData = {
- email: 'valid@example.com',
- password: 'longpassword'
- };
- const user = User.forge(userData);
- const stub = sinon.stub(user, 'save', function () {
- throw Error('stubbed error');
- });
- return Promise.try(function () {
- return user.register();
- }).catch(function (error) {
- st.equal(
- error.message,
- 'stubbed error',
- 'should respond with stubbed error'
- );
- stub.restore();
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement