getMethod,
getOwnPropertyDescriptor,
getOwnPropertyDescriptors,
+ getOwnPropertyEntries,
getOwnPropertyKeys,
getOwnPropertyStrings,
getOwnPropertySymbols,
+ getOwnPropertyValue,
+ getOwnPropertyValues,
getPropertyValue,
getPrototype,
hasOwnProperty,
});
});
+describe("getOwnPropertyEntries", () => {
+ it("[[Call]] gets own (but not inherited) property entries", () => {
+ assertEquals(
+ getOwnPropertyEntries({ success: true }),
+ [["success", true]],
+ );
+ });
+
+ it("[[Call]] works for values coercible to objects", () => {
+ assertEquals(
+ getOwnPropertyEntries("foo"),
+ [["0", "f"], ["1", "o"], ["2", "o"], ["length", 3]],
+ );
+ });
+
+ it("[[Call]] uses the provided receiver", () => {
+ const target = {};
+ assertEquals(
+ getOwnPropertyEntries({
+ get success() {
+ return this;
+ },
+ }, target),
+ [["success", target]],
+ );
+ });
+
+ it("[[Call]] throws for null and undefined", () => {
+ assertThrows(() => getOwnPropertyEntries(null));
+ assertThrows(() => getOwnPropertyEntries(undefined));
+ });
+
+ it("[[Construct]] throws an error", () => {
+ assertThrows(() => new getOwnPropertyEntries({}));
+ });
+
+ describe(".length", () => {
+ it("[[Get]] returns the correct length", () => {
+ assertStrictEquals(getOwnPropertyEntries.length, 1);
+ });
+ });
+
+ describe(".name", () => {
+ it("[[Get]] returns the correct name", () => {
+ assertStrictEquals(
+ getOwnPropertyEntries.name,
+ "getOwnPropertyEntries",
+ );
+ });
+ });
+});
+
describe("getOwnPropertyKeys", () => {
it("[[Call]] gets own (but not inherited) property keys", () => {
assertEquals(getOwnPropertyKeys({ success: true }), ["success"]);
});
});
+describe("getOwnPropertyValue", () => {
+ it("[[Call]] gets the own property value", () => {
+ assertStrictEquals(
+ getOwnPropertyValue({ success: true }, "success"),
+ true,
+ );
+ });
+
+ it("[[Call]] returns undefined for non‐own properties", () => {
+ assertStrictEquals(
+ getOwnPropertyValue(Object.create({ success: true }), "success"),
+ undefined,
+ );
+ });
+
+ it("[[Call]] works for values coercible to objects", () => {
+ assertStrictEquals(getOwnPropertyValue("foo", "length"), 3);
+ });
+
+ it("[[Call]] uses the provided receiver", () => {
+ const target = {};
+ assertStrictEquals(
+ getOwnPropertyValue(
+ {
+ get success() {
+ return this;
+ },
+ },
+ "success",
+ target,
+ ),
+ target,
+ );
+ });
+
+ it("[[Call]] throws for null and undefined", () => {
+ assertThrows(() => getOwnPropertyValue(null));
+ assertThrows(() => getOwnPropertyValue(undefined));
+ });
+
+ it("[[Construct]] throws an error", () => {
+ assertThrows(() => new getOwnPropertyValue({}));
+ });
+
+ describe(".length", () => {
+ it("[[Get]] returns the correct length", () => {
+ assertStrictEquals(getOwnPropertyValue.length, 2);
+ });
+ });
+
+ describe(".name", () => {
+ it("[[Get]] returns the correct name", () => {
+ assertStrictEquals(
+ getOwnPropertyValue.name,
+ "getOwnPropertyValue",
+ );
+ });
+ });
+});
+
+describe("getOwnPropertyValues", () => {
+ it("[[Call]] gets own (but not inherited) property values", () => {
+ assertEquals(getOwnPropertyValues({ success: true }), [true]);
+ });
+
+ it("[[Call]] works for values coercible to objects", () => {
+ assertEquals(
+ getOwnPropertyValues("foo"),
+ ["f", "o", "o", 3],
+ );
+ });
+
+ it("[[Call]] uses the provided receiver", () => {
+ const target = {};
+ assertEquals(
+ getOwnPropertyValues({
+ get success() {
+ return this;
+ },
+ }, target),
+ [target],
+ );
+ });
+
+ it("[[Call]] throws for null and undefined", () => {
+ assertThrows(() => getOwnPropertyValues(null));
+ assertThrows(() => getOwnPropertyValues(undefined));
+ });
+
+ it("[[Construct]] throws an error", () => {
+ assertThrows(() => new getOwnPropertyValues({}));
+ });
+
+ describe(".length", () => {
+ it("[[Get]] returns the correct length", () => {
+ assertStrictEquals(getOwnPropertyValues.length, 1);
+ });
+ });
+
+ describe(".name", () => {
+ it("[[Get]] returns the correct name", () => {
+ assertStrictEquals(
+ getOwnPropertyValues.name,
+ "getOwnPropertyValues",
+ );
+ });
+ });
+});
+
describe("getPropertyValue", () => {
it("[[Call]] gets property values on the provided object", () => {
assertStrictEquals(