"use strict";

var _utils = require("../utils/utils");
jest.useFakeTimers();
describe("checkKeyAvailability", () => {
  it("passes when key exists", () => {
    const testObj = {
      a: 1
    };
    (0, _utils.checkKeyAvailability)("a", testObj, "testObj");
    // Pass test if above expression doesn't throw anything.
    expect(true).toBe(true);
  });
  it("throws an error when key doesn't exist", () => {
    const testObj = {
      a: 1
    };
    try {
      (0, _utils.checkKeyAvailability)("b", testObj, "testObj");
      // Fail test if above expression doesn't throw anything.
      expect(true).toBe(false);
    } catch (e) {
      expect(e.message).toContain("does not exist in");
      expect(e.message).toContain("b");
      expect(e.message).toContain("testObj");
    }
  });
});
//# sourceMappingURL=utils.spec.js.map