Sha256: ae65710c2cf52b27e3a8fb1c9fd2ac470cba98eed473913a09c9e5b187893fdf

Contents?: true

Size: 753 Bytes

Versions: 3

Compression:

Stored size: 753 Bytes

Contents

import { AbstractTestCase } from 'internal-test-helpers';
import { runArrayTests, newFixture } from '../helpers/array';

class IndexOfTests extends AbstractTestCase {
  '@test should return index of object'() {
    let expected = newFixture(3);
    let obj = this.newObject(expected);
    let len = 3;

    for (let idx = 0; idx < len; idx++) {
      this.assert.equal(
        obj.indexOf(expected[idx]),
        idx,
        `obj.indexOf(${expected[idx]}) should match idx`
      );
    }
  }

  '@test should return -1 when requesting object not in index'() {
    let obj = this.newObject(newFixture(3));
    let foo = {};

    this.assert.equal(obj.indexOf(foo), -1, 'obj.indexOf(foo) should be < 0');
  }
}

runArrayTests('indexOf', IndexOfTests);

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
discourse-ember-source-3.6.0.0 dist/es/@ember/-internals/runtime/tests/array/indexOf-test.js
discourse-ember-source-3.5.1.1 dist/es/ember-runtime/tests/array/indexOf-test.js
discourse-ember-source-3.5.1.0 dist/dist/es/ember-runtime/tests/array/indexOf-test.js