Search code examples
ember.jsember-simple-auth

How to cover ember-simple-auth with acceptance tests?


I am trying to cover sign in page with acceptance tests. Small example:

test('visiting /sign-in', function(assert) {
  visit('/sign-in');

  fillIn('.t_sign-in_email', '[email protected]');
  fillIn('.t_sign-in_password', 'secret-password');
  click('.t_sign-in_submit');

  andThen(() => assert.equal(currentURL(), '/'));
});

But when it calls click function it immediately throws error:

SyntaxError: Unexpected token u in JSON at position 0

If I try sign in manually it works perfectly. Please help to find out what's wrong with this code?


Solution

  • The code above seems fine. I think your route handler expects a JSON string but receives something else. Are you using mirage?