mirror of
https://github.com/Kir-Antipov/mc-publish.git
synced 2024-11-22 00:11:02 -05:00
Tested getOwnEntries
against arrays
This commit is contained in:
parent
5c75c036c0
commit
0c53565546
1 changed files with 10 additions and 2 deletions
|
@ -135,7 +135,7 @@ describe("getAllEntries", () => {
|
|||
});
|
||||
|
||||
describe("getOwnEntries", () => {
|
||||
test("returns the key-value pairs from an object", () => {
|
||||
test("returns the key/value pairs from an object", () => {
|
||||
const obj = { a: 1, b: 2 };
|
||||
|
||||
const result = Array.from(getOwnEntries(obj));
|
||||
|
@ -143,7 +143,7 @@ describe("getOwnEntries", () => {
|
|||
expect(result).toEqual([["a", 1], ["b", 2]]);
|
||||
});
|
||||
|
||||
test("returns the key-value pairs from a map", () => {
|
||||
test("returns the key/value pairs from a map", () => {
|
||||
const map = new Map(Object.entries({ a: 1, b: 2 }));
|
||||
|
||||
const result = Array.from(getOwnEntries(map));
|
||||
|
@ -151,6 +151,14 @@ describe("getOwnEntries", () => {
|
|||
expect(result).toEqual([["a", 1], ["b", 2]]);
|
||||
});
|
||||
|
||||
test("returns the key/value pairs from an array of key/value pairs", () => {
|
||||
const entries = [["a", 1], ["b", 2]];
|
||||
|
||||
const result = Array.from(getOwnEntries(entries));
|
||||
|
||||
expect(result).toEqual([["a", 1], ["b", 2]]);
|
||||
});
|
||||
|
||||
test("returns empty array if the object is null or undefined", () => {
|
||||
expect(Array.from(getOwnEntries(null))).toEqual([]);
|
||||
expect(Array.from(getOwnEntries(undefined))).toEqual([]);
|
||||
|
|
Loading…
Reference in a new issue