samedi 20 juillet 2019

Unable to import andThen in acceptance test - ember.js

I am quite new to ember.js project where i am trying to write my first acceptance test for testing my root path works. I am following the below tutorial . I was unable to import "module-for-acceptance" from the helpers as its deprecated. when i run the below test i am getting an error which says (0 , _testHelpers.andThen) is not a function. I had also gone through ember js discussion post and imported andThen. It does not seem to work . How can i import andThen and make my test work . Thank you.

Test case

import { module, test } from 'qunit';
import { visit, currentURL ,andThen } from '@ember/test-helpers';
import { setupApplicationTest } from 'ember-qunit';


module('Acceptance | list rentals', function(hooks) {
  setupApplicationTest(hooks);

  test('should redirect to rentals route', function (assert) {
    visit('/');
    andThen(function() {
      assert.equal(currentURL(), '/rentals', 'should redirect automatically');
    });
  });

});

Log

Died on test #1     at Object.<anonymous> (http://localhost:7357/assets/tests.js:8:21)
    at processModule (http://localhost:7357/assets/test-support.js:3765:16)
    at module$1 (http://localhost:7357/assets/test-support.js:3790:4)
    at Module.callback (http://localhost:7357/assets/tests.js:6:21)
    at Module.exports (http://localhost:7357/assets/vendor.js:111:32)
    at requireModule (http://localhost:7357/assets/vendor.js:32:18)
    at TestLoader.require (http://localhost:7357/assets/test-support.js:13736:9): (0 , _testHelpers.andThen) is not a function@ 60 ms
Source:         
TypeError: (0 , _testHelpers.andThen) is not a function
    at Object.<anonymous> (http://localhost:7357/assets/tests.js:10:32)
    at runTest (http://localhost:7357/assets/test-support.js:5618:30)
    at Test.run (http://localhost:7357/assets/test-support.js:5604:6)
    at http://localhost:7357/assets/test-support.js:5831:12
    at processTaskQueue (http://localhost:7357/assets/test-support.js:5197:24)
    at advanceTaskQueue (http://localhost:7357/assets/test-support.js:5182:4)
    at Object.advance (http://localhost:7357/assets/test-support.js:5168:4)
    at unblockAndAdvanceQueue (http://localhost:7357/assets/test-support.js:6944:20)
    at begin (http://localhost:7357/assets/test-support.js:6978:5)
    at http://localhost:7357/assets/test-support.js:6219:6
Tried to restart test while already started (test's semaphore was 0 already)@ 61 ms
Source:         
    at resume (http://localhost:7357/assets/test-support.js:6171:5)
    at done (http://localhost:7357/assets/test-support.js:6362:7)
    at Class.asyncEnd (http://localhost:7357/assets/test-support.js:13822:9)
    at asyncEnd (http://localhost:7357/assets/vendor.js:68040:15)
    at http://localhost:7357/assets/vendor.js:67197:31
    at invoke (http://localhost:7357/assets/vendor.js:65509:16)
    at Queue.flush (http://localhost:7357/assets/vendor.js:65400:13)
    at DeferredActionQueues.flush (http://localhost:7357/assets/vendor.js:65597:21)



Aucun commentaire:

Enregistrer un commentaire