Sha256: 87b71bbee4e7058e31d71d7af9f58dc569f99c8f9ff7635350c9165bf67c763e

Contents?: true

Size: 704 Bytes

Versions: 2

Compression:

Stored size: 704 Bytes

Contents

import { get } from 'ember-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

2 entries across 2 versions & 1 rubygems

Version Path
discourse-ember-source-3.5.1.1 dist/es/ember-runtime/tests/array/sortBy-test.js
discourse-ember-source-3.5.1.0 dist/dist/es/ember-runtime/tests/array/sortBy-test.js