I am using validated methods (mdg:validated-method
) with LoggedInMixin (tunifight:loggedin-mixin
).
Now I have a problem with my unit tests, as they fail with notLogged
error, because in the unit tests there is no logged user of course.
How do I have to stub that?
method
const resetEdit = new ValidatedMethod({
name: 'reset',
mixins: [LoggedInMixin],
checkLoggedInError: { error: 'notLogged' }, // <- throws error if user is not logged in
validate: null,
run ({ id }) {
// ...
}
})
unit test
describe('resetEdit', () => {
it('should reset data', (done) => {
resetEdit.call({ id: 'IDString' })
})
})
Unit tests throws Error: [notLogged]
.