mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-20 08:33:11 +00:00
feat: migrate to esm
This commit is contained in:
@@ -12,22 +12,31 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {stringSort, stringSortBy} from '../src/string-sort';
|
||||
import {expect} from "chai";
|
||||
import { stringSort, stringSortBy } from "../src/string-sort.js";
|
||||
import { expect } from "chai";
|
||||
|
||||
describe('stringSort', () => {
|
||||
it('should sort an array of strings', () => {
|
||||
expect(['a', 'c', 'b', 'd'].sort(stringSort)).to.deep.equal(['a', 'b', 'c', 'd']);
|
||||
});
|
||||
});
|
||||
|
||||
describe('stringSortBy', () => {
|
||||
it('should sort an array of strings', () => {
|
||||
expect([{item: 'a'}, {item: 'c'}, {item: 'b'}, {item: 'd'}].sort(stringSortBy(it => it.item))).to.deep.equal([
|
||||
{item: 'a'},
|
||||
{item: 'b'},
|
||||
{item: 'c'},
|
||||
{item: 'd'},
|
||||
describe("stringSort", () => {
|
||||
it("should sort an array of strings", () => {
|
||||
expect(["a", "c", "b", "d"].sort(stringSort)).to.deep.equal([
|
||||
"a",
|
||||
"b",
|
||||
"c",
|
||||
"d",
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("stringSortBy", () => {
|
||||
it("should sort an array of strings", () => {
|
||||
expect(
|
||||
[{ item: "a" }, { item: "c" }, { item: "b" }, { item: "d" }].sort(
|
||||
stringSortBy((it) => it.item)
|
||||
)
|
||||
).to.deep.equal([
|
||||
{ item: "a" },
|
||||
{ item: "b" },
|
||||
{ item: "c" },
|
||||
{ item: "d" },
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user