-// ♓🌟 Piscēs ∷ iterable.test.js
-// ====================================================================
-//
-// Copyright © 2023 Lady [@ Lady’s Computer].
-//
-// This Source Code Form is subject to the terms of the Mozilla Public
-// License, v. 2.0. If a copy of the MPL was not distributed with this
-// file, You can obtain one at <https://mozilla.org/MPL/2.0/>.
+// SPDX-FileCopyrightText: 2023, 2025 Lady <https://www.ladys.computer/about/#lady>
+// SPDX-License-Identifier: MPL-2.0
+/**
+ * ⁌ ♓🧩 Piscēs ∷ iterable.test.js
+ *
+ * Copyright © 2023, 2025 Lady [@ Ladys Computer].
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at <https://mozilla.org/MPL/2.0/>.
+ */
import {
assertEquals,
});
});
+ it("[[Construct]] throws an error", () => {
+ const iterator = arrayIteratorFunction();
+ assertThrows(() => new iterator([]));
+ });
+
+ describe(".length", () => {
+ it("[[Get]] returns the correct length", () => {
+ assertStrictEquals(arrayIteratorFunction().length, 1);
+ });
+ });
+
+ describe(".name", () => {
+ it("[[Get]] returns the correct name", () => {
+ assertStrictEquals(
+ arrayIteratorFunction().name,
+ "values",
+ );
+ });
+ });
+
describe("::next", () => {
it("[[Call]] throws if there are values and the mapper is not a generator function", () => {
const iterator = arrayIteratorFunction(function () {});
});
});
+ it("[[Construct]] throws an error", () => {
+ const iterator = generatorIteratorFunction();
+ assertThrows(() => new iterator(function* () {}));
+ });
+
+ describe(".length", () => {
+ it("[[Get]] returns the correct length", () => {
+ assertStrictEquals(generatorIteratorFunction().length, 1);
+ });
+ });
+
+ describe(".name", () => {
+ it("[[Get]] returns the correct name", () => {
+ assertStrictEquals(
+ generatorIteratorFunction().name,
+ "yields",
+ );
+ });
+ });
+
describe("::next", () => {
it("[[Call]] throws if there are values and the mapper is not a generator function", () => {
const generator = function* () {
});
});
+ it("[[Construct]] throws an error", () => {
+ const iterator = mapIteratorFunction();
+ assertThrows(() => new iterator(new Map()));
+ });
+
+ describe(".length", () => {
+ it("[[Get]] returns the correct length", () => {
+ assertStrictEquals(mapIteratorFunction().length, 1);
+ });
+ });
+
+ describe(".name", () => {
+ it("[[Get]] returns the correct name", () => {
+ assertStrictEquals(
+ mapIteratorFunction().name,
+ "entries",
+ );
+ });
+ });
+
describe("::next", () => {
it("[[Call]] throws if there are values and the mapper is not a generator function", () => {
const iterator = mapIteratorFunction(function () {});
});
});
+ it("[[Construct]] throws an error", () => {
+ const iterator = setIteratorFunction();
+ assertThrows(() => new iterator(new Set()));
+ });
+
+ describe(".length", () => {
+ it("[[Get]] returns the correct length", () => {
+ assertStrictEquals(setIteratorFunction().length, 1);
+ });
+ });
+
+ describe(".name", () => {
+ it("[[Get]] returns the correct name", () => {
+ assertStrictEquals(
+ setIteratorFunction().name,
+ "values",
+ );
+ });
+ });
+
describe("::next", () => {
it("[[Call]] throws if there are values and the mapper is not a generator function", () => {
const iterator = setIteratorFunction(function () {});
});
});
+ it("[[Construct]] throws an error", () => {
+ const iterator = stringIteratorFunction();
+ assertThrows(() => new iterator(""));
+ });
+
+ describe(".length", () => {
+ it("[[Get]] returns the correct length", () => {
+ assertStrictEquals(stringIteratorFunction().length, 1);
+ });
+ });
+
+ describe(".name", () => {
+ it("[[Get]] returns the correct name", () => {
+ assertStrictEquals(
+ stringIteratorFunction().name,
+ "characters",
+ );
+ });
+ });
+
describe("::next", () => {
it("[[Call]] throws if there are values and the mapper is not a generator function", () => {
const iterator = stringIteratorFunction(function () {});