+describe("defineOwnDataProperty", () => {
+ it("[[Call]] defines the property", () => {
+ const obj = {};
+ defineOwnDataProperty(obj, "etaoin", "success");
+ assert(Object.hasOwn(obj, "etaoin"));
+ assertStrictEquals(obj.etaoin, "success");
+ });
+
+ it("[[Call]] defines a configurable, enumerable, writable property", () => {
+ const obj = {};
+ defineOwnDataProperty(obj, "etaoin", "success");
+ assertEquals(
+ Object.getOwnPropertyDescriptor(obj, "etaoin"),
+ {
+ configurable: true,
+ enumerable: true,
+ value: "success",
+ writable: true,
+ },
+ );
+ });
+
+ it("[[Call]] returns the provided object", () => {
+ const obj = {};
+ assertStrictEquals(
+ defineOwnDataProperty(obj, "etaoin", null),
+ obj,
+ );
+ });
+
+ it("[[Construct]] throws an error", () => {
+ assertThrows(() => new defineOwnDataProperty(obj, "etaoin", null));
+ });
+
+ describe(".length", () => {
+ it("[[Get]] returns the correct length", () => {
+ assertStrictEquals(defineOwnDataProperty.length, 3);
+ });
+ });
+
+ describe(".name", () => {
+ it("[[Get]] returns the correct name", () => {
+ assertStrictEquals(
+ defineOwnDataProperty.name,
+ "defineOwnDataProperty",
+ );
+ });
+ });
+});
+
+describe("defineOwnNonenumerableDataProperty", () => {
+ it("[[Call]] defines the property", () => {
+ const obj = {};
+ defineOwnNonenumerableDataProperty(obj, "etaoin", "success");
+ assert(Object.hasOwn(obj, "etaoin"));
+ assertStrictEquals(obj.etaoin, "success");
+ });
+
+ it("[[Call]] defines a configurable, non·enumerable, writable property", () => {
+ const obj = {};
+ defineOwnNonenumerableDataProperty(obj, "etaoin", "success");
+ assertEquals(
+ Object.getOwnPropertyDescriptor(obj, "etaoin"),
+ {
+ configurable: true,
+ enumerable: false,
+ value: "success",
+ writable: true,
+ },
+ );
+ });
+
+ it("[[Call]] returns the provided object", () => {
+ const obj = {};
+ assertStrictEquals(
+ defineOwnNonenumerableDataProperty(obj, "etaoin", null),
+ obj,
+ );
+ });
+
+ it("[[Construct]] throws an error", () => {
+ assertThrows(() =>
+ new defineOwnNonenumerableDataProperty(obj, "etaoin", null)
+ );
+ });
+
+ describe(".length", () => {
+ it("[[Get]] returns the correct length", () => {
+ assertStrictEquals(defineOwnNonenumerableDataProperty.length, 3);
+ });
+ });
+
+ describe(".name", () => {
+ it("[[Get]] returns the correct name", () => {
+ assertStrictEquals(
+ defineOwnNonenumerableDataProperty.name,
+ "defineOwnNonenumerableDataProperty",
+ );
+ });
+ });
+});
+