2020-07-04 14:09:48 -03:00
|
|
|
test("use with array", () => {
|
2020-07-06 11:37:45 -03:00
|
|
|
let names = Object.getOwnPropertyNames([1, 2, 3]);
|
|
|
|
|
expect(names).toEqual(["0", "1", "2", "length"]);
|
2020-07-04 14:09:48 -03:00
|
|
|
});
|
2020-03-28 21:08:25 -03:00
|
|
|
|
2020-07-04 14:09:48 -03:00
|
|
|
test("use with object", () => {
|
2020-07-06 11:37:45 -03:00
|
|
|
let names = Object.getOwnPropertyNames({ foo: 1, bar: 2, baz: 3 });
|
|
|
|
|
expect(names).toEqual(["foo", "bar", "baz"]);
|
2020-07-04 14:09:48 -03:00
|
|
|
});
|
2020-07-08 01:39:36 -03:00
|
|
|
|
|
|
|
|
test("use with object with symbol keys", () => {
|
|
|
|
|
let names = Object.getOwnPropertyNames({ foo: 1, [Symbol("bar")]: 2, baz: 3 });
|
|
|
|
|
expect(names).toEqual(["foo", "baz"]);
|
|
|
|
|
});
|
2021-06-19 06:46:08 -03:00
|
|
|
|
|
|
|
|
test("use with String object", () => {
|
|
|
|
|
let names = Object.getOwnPropertyNames(new String("foo"));
|
|
|
|
|
expect(names).toEqual(["0", "1", "2", "length"]);
|
|
|
|
|
});
|