Sha256: fa35c92968c4c492bbbe80617f5d8e3811603cef9b82c605d4df911072c237ef

Contents?: true

Size: 1 KB

Versions: 3

Compression:

Stored size: 1 KB

Contents

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

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

    after = newFixture(3);
    before = [after[0], after[1], after[2], after[1], after[0]];
    obj = this.newObject(before);
    before = obj.toArray(); // in case of set before will be different...

    ret = obj.uniq();
    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 return duplicate of same content if no duplicates found'() {
    let item, obj, ret;
    obj = this.newObject(newFixture(3));
    ret = obj.uniq(item);
    this.assert.ok(ret !== obj, 'should not be same object');
    this.assert.deepEqual(this.toArray(ret), this.toArray(obj), 'should be the same content');
  }
}

runArrayTests('uniq', UniqTests);

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