Sha256: ab616dc70269abd3259c7e4cf97f0835e975d9e6c9db60ee4c4850ba390335dc

Contents?: true

Size: 1.13 KB

Versions: 3

Compression:

Stored size: 1.13 KB

Contents

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

class WithoutTests extends AbstractTestCase {
  '@test should return new instance with item removed'() {
    let before, after, obj, ret;

    before = newFixture(3);
    after = [before[0], before[2]];
    obj = this.newObject(before);

    ret = obj.without(before[1]);
    this.assert.deepEqual(this.toArray(ret), after, 'should have removed item');
    this.assert.deepEqual(this.toArray(obj), before, 'should not have changed original');
  }

  '@test should remove NaN value'() {
    let before, after, obj, ret;

    before = [...newFixture(2), NaN];
    after = [before[0], before[1]];
    obj = this.newObject(before);

    ret = obj.without(NaN);
    this.assert.deepEqual(this.toArray(ret), after, 'should have removed item');
  }

  '@test should return same instance if object not found'() {
    let item, obj, ret;

    item = newFixture(1)[0];
    obj = this.newObject(newFixture(3));

    ret = obj.without(item);
    this.assert.equal(ret, obj, 'should be same instance');
  }
}

runArrayTests('without', WithoutTests);

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/without-test.js
discourse-ember-source-3.5.1.1 dist/es/ember-runtime/tests/array/without-test.js
discourse-ember-source-3.5.1.0 dist/dist/es/ember-runtime/tests/array/without-test.js