Sha256: ecd268c433ac2a4f013126227113150012a7a4eb3304f85cee464553677ba5fc

Contents?: true

Size: 673 Bytes

Versions: 3

Compression:

Stored size: 673 Bytes

Contents

import { cancelTimers, end, getCurrentRunLoop, hasScheduledTimers } from '@ember/runloop';

function RunLoopAssertion(env) {
  this.env = env;
}

RunLoopAssertion.prototype = {
  reset: function() {},
  inject: function() {},
  assert: function() {
    let { assert } = QUnit.config.current;

    if (getCurrentRunLoop()) {
      assert.ok(false, 'Should not be in a run loop at end of test');
      while (getCurrentRunLoop()) {
        end();
      }
    }

    if (hasScheduledTimers()) {
      assert.ok(false, 'Ember run should not have scheduled timers at end of test');
      cancelTimers();
    }
  },
  restore: function() {},
};

export default RunLoopAssertion;

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
discourse-ember-source-3.6.0.0 dist/es/internal-test-helpers/lib/ember-dev/run-loop.js
discourse-ember-source-3.5.1.1 dist/es/internal-test-helpers/lib/ember-dev/run-loop.js
discourse-ember-source-3.5.1.0 dist/dist/es/internal-test-helpers/lib/ember-dev/run-loop.js