[ 
https://issues.apache.org/jira/browse/TINKERPOP-2872?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17804894#comment-17804894
 ] 

ASF GitHub Bot commented on TINKERPOP-2872:
-------------------------------------------

vkagamlyk commented on code in PR #2422:
URL: https://github.com/apache/tinkerpop/pull/2422#discussion_r1446652455


##########
gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/element-comparison.js:
##########
@@ -0,0 +1,122 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+/*
+ * Portions of this code are based on the Chai Assertion Library
+ * at https://www.chaijs.com/, which is licensed under the MIT License.
+ * The functions deepMembersById, flag, and isSubsetOf are adapted from
+ * Chai's source code.
+ * See licenses/chai for full license.
+ */
+
+const chai = require('chai');
+const deepEqual = require('deep-eql');
+
+function isElement(obj) {
+    return obj !== null && obj.hasOwnProperty('id') && 
obj.hasOwnProperty('label');

Review Comment:
   can we use `obj instanceof Element` here?





> Inconsistency in comparing Elements in JavaScript tests
> -------------------------------------------------------
>
>                 Key: TINKERPOP-2872
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-2872
>             Project: TinkerPop
>          Issue Type: Improvement
>          Components: javascript
>    Affects Versions: 3.7.0
>            Reporter: Valentyn Kahamlyk
>            Priority: Major
>
> In most GLV's we consider Elements the same when they have the same ID.
> In JavaScript tests used [member wise 
> comparison|https://github.com/apache/tinkerpop/blob/master/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js#L176]
> Make it work like the others GLV's, just compare ID.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to