javascript-functions
Version:
Commonly used JavaScript Functions
24 lines (19 loc) • 569 B
JavaScript
import * as jsf from "./objects.js";
describe("objToArray()", () => {
it("Converts Objects into two dimensional array", () => {
const output = jsf.objToArray({ x: 1, y: 2 });
expect(output).toEqual([
["x", 1],
["y", 2],
]);
});
it("Should throw an error", () => {
expect(() => jsf.objToArray(["x", 1])).toThrow();
});
it("Should throw an error", () => {
expect(() => jsf.objToArray("X")).toThrow();
});
it("Should throw an error", () => {
expect(() => jsf.objToArray(1)).toThrow();
});
});