Client integration test with velocity and jasmine on Meteor

562 views Asked by At

I made this test:

describe('SignIn', function () {
it('should be able to login normal user', function (done) {
    Meteor.loginWithPassword('[email protected]', '000000', function (err) {
        expect(err).toBeUndefined();
        done();
    });
  });
});

And I get the following error:

Expected { error : 403, reason : 'User not found', details : undefined, message : 'User not found [403]', errorType : 'Meteor.Error' } to be undefined. While the user exists (can log in with the form)

But I can signin as '[email protected]' with the form of the meteor app so the user exists. Is there something wrong with my code?

1

There are 1 answers

1
Xolv.io On BEST ANSWER

Nothing is wrong with your code, it's because the test are running against a mirror, which is a parallel app. This approach allows tests to be destructive with data without affecting the main app.

What you should do is to create a user in a before block, then you can login with that user.