Ember Verification Routing Forwarding

I am very new to Ember and have never written a test case before. I currently have a route that is used as a base class and will be propagated by other routes in order to use the same behavior for redirection. Here's what the route looks like:

import Ember from 'ember'; export default Ember.Route.extend({ redirect: function(){ var user = this.modelFor('application').user; if(Ember.isEmpty(user.get('auth'))){ this.transitionTo('login'); } }, model: function(){ return this.modelFor('application').user; } }); 

So, testing this manually works fine, if I type a direct url for the screen, it will be redirected to the login. This is the functioning code we want. I was instructed to write unit test and could not find anything useful. This is probably my inexperience in understanding things, but I need to figure out how to test this code. I would like some help and some explanation, as well as what is being done. I have to do unit tests and much more for this ember project and be very new. I already wasted 2 days researching how to test this class.

+5
source share
1 answer

IMO, there is nothing to test for this route with unit test. You need to write acceptance tests for this route.

Check out the Ember Guides for route testing. You do not have any properties or actions to write a unit test for this route. Write acceptance tests .

+3
source