<commit_before>import EmberDebug from "ember_debug";
import App from "test_app";

var port;


function getChildrenProperty(route, prop) {
  return route.children.map(function(item) {return Ember.get(item.value, prop); });
}

module("Route Debug", {
  setup: function() {

    EmberDebug.Port = EmberDebug.Port.extend({
      init: function() {},
      send: function() {}
    });


    App.reset();

    EmberDebug.start();
    port = EmberDebug.port;
  }
});


test("Route tree", function() {
  var name = null, message = null, route, children;
  port.reopen({
    send: function(n, m) {
      name = n;
      message = m;
    }
  });

  port.trigger('route:getTree');

  equal(name, 'route:routeTree');

  route = message.tree;
  equal(route.value.name, 'application');
  equal(route.value.type, 'resource');
  equal(route.value.controller.name, 'application');
  equal(route.value.controller.className, 'ApplicationController');
  equal(route.value.routeHandler.name, 'application');
  equal(route.value.routeHandler.className, 'ApplicationRoute');
  equal(route.value.template.name, 'application');<commit_msg>Fix route tests to account for loading and error substates<commit_after>import EmberDebug from "ember_debug";
import App from "test_app";

var port;


function getChildrenProperty(route, prop) {
  return route.children.map(function(item) {return Ember.get(item.value, prop); });
}

module("Route Debug", {
  setup: function() {

    EmberDebug.Port = EmberDebug.Port.extend({
      init: function() {},
      send: function() {}
    });


    App.reset();
    EmberDebug.start();
    port = EmberDebug.port;
  }
});


test("Route tree", function() {
  var name = null, message = null, route, children;
  port.reopen({
    send: function(n, m) {
      name = n;
      message = m;
    }
  });

  port.trigger('route:getTree');

  equal(name, 'route:routeTree');

  route = message.tree;
  equal(route.value.name, 'application');
  equal(route.value.type, 'resource');
  equal(route.value.controller.name, 'application');
  equal(route.value.controller.className, 'ApplicationController');
  equal(route.value.routeHandler.name, 'application');
  equal(route.value.routeHandler.className, 'ApplicationRoute');
  equal(route.value.template.name, 'application');
{'fraction_non_alphanumeric': 0.15933098591549297, 'fraction_numerical': 0.0, 'mean_word_length': 4.107865168539326, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7296077', 'n_tokens_mistral': 722, 'n_tokens_neox': 704, 'n_words': 146}