summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Tests
diff options
context:
space:
mode:
authorIdan Horowitz <idan.horowitz@gmail.com>2021-06-12 17:41:13 +0300
committerLinus Groh <mail@linusgroh.de>2021-06-12 18:39:23 +0100
commitbd9e20ef791a614deec2a7e37f3be1657f75816a (patch)
tree905f08dbad6400d3ebbca61511f2813cec49e4b9 /Userland/Libraries/LibJS/Tests
parenta2da3f97eff59dd6778de085b7d4d7d7ea0f250a (diff)
downloadserenity-bd9e20ef791a614deec2a7e37f3be1657f75816a.zip
LibJS: Add the Object.getOwnPropertySymbols method
Diffstat (limited to 'Userland/Libraries/LibJS/Tests')
-rw-r--r--Userland/Libraries/LibJS/Tests/builtins/Object/Object.getOwnPropertySymbols.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/Userland/Libraries/LibJS/Tests/builtins/Object/Object.getOwnPropertySymbols.js b/Userland/Libraries/LibJS/Tests/builtins/Object/Object.getOwnPropertySymbols.js
new file mode 100644
index 0000000000..f431cd07b6
--- /dev/null
+++ b/Userland/Libraries/LibJS/Tests/builtins/Object/Object.getOwnPropertySymbols.js
@@ -0,0 +1,16 @@
+test("use with array", () => {
+ let names = Object.getOwnPropertySymbols([1, 2, 3]);
+ console.log(names);
+ expect(names).toEqual([]);
+});
+
+test("use with object", () => {
+ let names = Object.getOwnPropertySymbols({ [Symbol.iterator]: 1, [Symbol.species]: 2 });
+ expect(names).toEqual([Symbol.iterator, Symbol.species]);
+});
+
+test("use with object with string keys", () => {
+ let symbol = Symbol("bar");
+ let names = Object.getOwnPropertySymbols({ foo: 1, [symbol]: 2, baz: 3 });
+ expect(names).toEqual([symbol]);
+});