mirror of
https://github.com/Kir-Antipov/mc-publish.git
synced 2024-11-22 16:31:04 -05:00
21 lines
795 B
TypeScript
21 lines
795 B
TypeScript
|
import { isKeyValueIterable } from "@/utils/collections/key-value-iterable";
|
||
|
|
||
|
describe("isKeyValueIterable", () => {
|
||
|
test("returns true for objects that have entries", () => {
|
||
|
expect(isKeyValueIterable(new Map())).toBe(true);
|
||
|
expect(isKeyValueIterable(new Set())).toBe(true);
|
||
|
expect(isKeyValueIterable([])).toBe(true);
|
||
|
expect(isKeyValueIterable({ entries: () => [] })).toBe(true);
|
||
|
});
|
||
|
|
||
|
test("returns false for objects that has no entries", () => {
|
||
|
expect(isKeyValueIterable({})).toBe(false);
|
||
|
expect(isKeyValueIterable(new Date())).toBe(false);
|
||
|
});
|
||
|
|
||
|
test("returns false for null and undefined", () => {
|
||
|
expect(isKeyValueIterable(null)).toBe(false);
|
||
|
expect(isKeyValueIterable(undefined)).toBe(false);
|
||
|
});
|
||
|
});
|