AnsweredAssumed Answered

How is esriLoader (angular-esri-map) intended to be used in karma tests and what is its true purpose?

Question asked by jwerts on Apr 21, 2016
Latest reply on Apr 21, 2016 by jwerts

I'm trying to understand the esriLoader utility in angular-esri-map.  I'm not completely clear on the purpose of using it instead of dojo's require directly.  Furthermore, I've been completely unable to figure out how to use it in karma/mocha tests.  Specifically, the promises never return and mocha times out.  Previously, i was using the karma-dojo plugin and calling dojo's require directly which seems to work.  My big assumption here is that esriLoader should allow me to ditch the karma-dojo plugin.


I've tried many iterations of this without any luck (including some attempts to add in $rootScope.$apply() calls).  Here's just one of them:


describe('pointsModel spec', function() {
  var pointsModel;
  var esriLoader;


  beforeEach(inject(function(_pointsModel_, _esriLoader_) {
    pointsModel = _pointsModel_;
    esriLoader = _esriLoader_;

  var Collection;
  beforeEach(function(done) {
    esriLoader.bootstrap().then(function() {
      ], function(_Collection) {
        Collection = _Collection;

  describe('construction', function() {
    it('should inject pointsModel', function() {

  describe("summary", function() {
    var points;

    beforeEach(function() {
      points = new Collection();

    it('should count indexes', function() {
        { attributes: {index: 1}},
        { attributes: {index: 2}}