Sha256: 3bec5a6428566b821607f400b82bf2d4dad738b03c7ca38db4af2b78d013f257

Contents?: true

Size: 855 Bytes

Versions: 3

Compression:

Stored size: 855 Bytes

Contents

import { run } from '..';
import { moduleFor, AbstractTestCase } from 'internal-test-helpers';

moduleFor(
  'system/run_loop/run_test',
  class extends AbstractTestCase {
    ['@test run invokes passed function, returning value'](assert) {
      let obj = {
        foo() {
          return [this.bar, 'FOO'];
        },
        bar: 'BAR',
        checkArgs(arg1, arg2) {
          return [arg1, this.bar, arg2];
        },
      };

      assert.equal(run(() => 'FOO'), 'FOO', 'pass function only');
      assert.deepEqual(run(obj, obj.foo), ['BAR', 'FOO'], 'pass obj and obj.method');
      assert.deepEqual(run(obj, 'foo'), ['BAR', 'FOO'], 'pass obj and "method"');
      assert.deepEqual(
        run(obj, obj.checkArgs, 'hello', 'world'),
        ['hello', 'BAR', 'world'],
        'pass obj, obj.method, and extra arguments'
      );
    }
  }
);

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
discourse-ember-source-3.6.0.0 dist/es/@ember/runloop/tests/run_test.js
discourse-ember-source-3.5.1.1 dist/es/@ember/runloop/tests/run_test.js
discourse-ember-source-3.5.1.0 dist/dist/es/@ember/runloop/tests/run_test.js