Tweaks to left pane snapping logic

This commit is contained in:
Evan Hahn 2021-10-14 16:19:50 -05:00 committed by GitHub
parent 29e6ba8f10
commit 0faeda28f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 51 additions and 8 deletions

View file

@ -0,0 +1,26 @@
// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { assert } from 'chai';
import { isSorted } from '../../util/isSorted';
describe('isSorted', () => {
it('returns true for empty lists', () => {
assert.isTrue(isSorted([]));
});
it('returns true for one-element lists', () => {
assert.isTrue(isSorted([5]));
});
it('returns true for sorted lists', () => {
assert.isTrue(isSorted([1, 2]));
assert.isTrue(isSorted([1, 2, 2, 3]));
});
it('returns false for out-of-order lists', () => {
assert.isFalse(isSorted([2, 1]));
assert.isFalse(isSorted([1, 2, 2, 3, 0]));
});
});