UNPKG

@aricma/itemids

Version:

Be faster in creating and updating react state, with the ItemIds object.

92 lines (88 loc) 3.99 kB
"use strict"; var ERRORS = _interopRequireWildcard(require("./errors")); function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; } function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } describe("ERRORS", () => { describe("ItemIds", () => { test("givenWasNoArray", () => { expect(typeof ERRORS.ItemIds.givenWasNoArray).toBe("string"); }); }); describe("utils", () => { describe("_with", () => { test("gotFunction", () => { expect(typeof ERRORS.utils._with.gotFunction).toBe("string"); }); }); describe("_can", () => { test("gotNoFunction", () => { expect(typeof ERRORS.utils._can.gotNoFunction).toBe("string"); }); }); }); describe("staticMethods", () => { describe("unify", () => { test("gotNoItemIdList", () => { expect(typeof ERRORS.staticMethods.unify.gotNoItemIdList).toBe("string"); }); }); }); describe("methods", () => { describe("set", () => { test("isNotBoundToAnArray", () => { expect(typeof ERRORS.methods.set.isNotBoundToAnArray).toBe("string"); }); test("gotNeitherItemIdListNorFunction", () => { expect(typeof ERRORS.methods.set.gotNeitherItemIdListNorFunction).toBe("string"); }); }); describe("add", () => { test("isNotBoundToAnArray", () => { expect(typeof ERRORS.methods.add.isNotBoundToAnArray).toBe("string"); }); test("gotNeitherItemIdNorItemIdList", () => { expect(typeof ERRORS.methods.add.gotNeitherItemIdNorItemIdList).toBe("string"); }); }); describe("remove", () => { test("isNotBoundToAnArray", () => { expect(typeof ERRORS.methods.remove.isNotBoundToAnArray).toBe("string"); }); test("gotNeitherItemIdNorItemIdList", () => { expect(typeof ERRORS.methods.remove.gotNeitherItemIdNorItemIdList).toBe("string"); }); }); describe("toggle", () => { test("isNotBoundToAnArray", () => { expect(typeof ERRORS.methods.toggle.isNotBoundToAnArray).toBe("string"); }); test("gotNeitherItemIdNorItemIdList", () => { expect(typeof ERRORS.methods.toggle.gotNeitherItemIdNorItemIdList).toBe("string"); }); }); describe("toggleAll", () => { test("isNotBoundToAnArray", () => { expect(typeof ERRORS.methods.toggleAll.isNotBoundToAnArray).toBe("string"); }); test("gotNoItemIdList", () => { expect(typeof ERRORS.methods.toggleAll.gotNoItemIdList).toBe("string"); }); }); describe("has", () => { test("isNotBoundToAnArray", () => { expect(typeof ERRORS.methods.has.isNotBoundToAnArray).toBe("string"); }); test("gotNeitherItemIdNorItemIdList", () => { expect(typeof ERRORS.methods.has.gotNeitherItemIdNorItemIdList).toBe("string"); }); }); describe("isEqualTo", () => { test("isNotBoundToAnArray", () => { expect(typeof ERRORS.methods.isEqualTo.isNotBoundToAnArray).toBe("string"); }); test("gotNoItemIdList", () => { expect(typeof ERRORS.methods.isEqualTo.gotNoItemIdList).toBe("string"); }); }); }); });