feat: migrate to esm

This commit is contained in:
2023-03-16 01:58:13 +01:00
parent fd740b3091
commit 4df19e8c20
512 changed files with 3016 additions and 2222 deletions

View File

@@ -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" },
]);
});
});