Son CV dans un terminal web en Javascript! https://terminal-cv.gregandev.fr
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
859 B

// @flow
import assert from 'assert';
import {objectSortedEntries, objectSortedEntriesDeep} from '../src/collection';
describe('objectSortedEntries', () => {
it('returns a sorted list of key/value tuples', () => {
assert.deepEqual(
objectSortedEntries({foo: 'foo', baz: 'baz', bar: 'bar'}),
[
['bar', 'bar'],
['baz', 'baz'],
['foo', 'foo'],
],
);
});
});
describe('objectSortedEntriesDeep', () => {
it('returns a deeply sorted list of key/value tuples', () => {
assert.deepEqual(
objectSortedEntriesDeep({
foo: 'foo',
baz: ['d', 'c'],
bar: {g: 'g', b: 'b'},
}),
[
[
'bar',
[
['b', 'b'],
['g', 'g'],
],
],
['baz', ['d', 'c']],
['foo', 'foo'],
],
);
});
});