Sha256: 717db1775a57016931745439902fc7c3a46e13e9f0dff8aaca99f7f8612a9996

Contents?: true

Size: 716 Bytes

Versions: 1

Compression:

Stored size: 716 Bytes

Contents

import { get } from '@ember/-internals/metal';
import { AbstractTestCase } from 'internal-test-helpers';
import { runArrayTests } from '../helpers/array';

class SortByTests extends AbstractTestCase {
  '@test sort by value of property'() {
    let obj = this.newObject([{ a: 2 }, { a: 1 }]);
    let sorted = obj.sortBy('a');

    this.assert.equal(get(sorted[0], 'a'), 1);
    this.assert.equal(get(sorted[1], 'a'), 2);
  }

  '@test supports multiple propertyNames'() {
    let obj = this.newObject([{ a: 1, b: 2 }, { a: 1, b: 1 }]);
    let sorted = obj.sortBy('a', 'b');

    this.assert.equal(get(sorted[0], 'b'), 1);
    this.assert.equal(get(sorted[1], 'b'), 2);
  }
}

runArrayTests('sortBy', SortByTests);

Version data entries

1 entries across 1 versions & 1 rubygems

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