diff --git a/__mocks__/@nextcloud/router.js b/__mocks__/@nextcloud/router.js index 155319c0..57dbea15 100644 --- a/__mocks__/@nextcloud/router.js +++ b/__mocks__/@nextcloud/router.js @@ -1,5 +1,9 @@ -/** +/*! * SPDX-FileCopyrightText: 2022-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ + +/** + * @param {string} path The path + */ export const generateRemoteUrl = (path) => `https://localhost/${path}` diff --git a/__tests__/utils/sorting.spec.ts b/__tests__/utils/sorting.spec.ts index defd896b..e749d4ab 100644 --- a/__tests__/utils/sorting.spec.ts +++ b/__tests__/utils/sorting.spec.ts @@ -112,4 +112,22 @@ describe('orderBy', () => { ).map((v) => v.text), ).toEqual(['monday', 'tuesday', 'wednesday']) }) + + test('sort with equal values', () => { + const array = [ + { text: 'Dienstag', value: 2 }, + { text: 'Monday', value: 1 }, + { text: 'Wednesday', value: 3 }, + { text: 'Tuesday', value: 2 }, + ] + + const ordered = orderBy( + array, + [(v) => v.value], + ) + + expect(ordered[0].text).toBe('Monday') + expect(ordered[3].text).toBe('Wednesday') + // the rest can be in any order + }) })