This is an automated email from the ASF dual-hosted git repository.
colegreer pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
The following commit(s) were added to refs/heads/master by this push:
new 06286b23b9 CTR JS import fixes
06286b23b9 is described below
commit 06286b23b9e92fe6827cdb31473d99fcafcf53c1
Author: Cole Greer <[email protected]>
AuthorDate: Tue Jan 20 12:56:29 2026 -0800
CTR JS import fixes
---
.../main/javascript/gremlin-javascript/test/helper.js | 4 ++++
.../gremlin-javascript/test/integration/client-tests.js | 16 ++++++++--------
.../test/integration/socket-connection-tests.js | 8 ++++----
.../test/integration/traversal-test.js | 12 ++++++------
4 files changed, 22 insertions(+), 18 deletions(-)
diff --git
a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js
b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js
index 33c1bb55e0..304fba7a8c 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js
@@ -64,6 +64,10 @@ export function getDriverRemoteConnection(url, options) {
return new DriverRemoteConnection(url, { ...options, mimeType:
process.env.CLIENT_MIMETYPE });
}
+export function getDriverRemoteConnectionGraphSON(traversalSource) {
+ return new DriverRemoteConnection(serverUrl, { traversalSource, mimeType:
'application/vnd.gremlin-v3.0+json' });
+}
+
export function getClient(traversalSource) {
return new Client(serverUrl, { traversalSource, mimeType:
process.env.CLIENT_MIMETYPE });
}
diff --git
a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/client-tests.js
b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/client-tests.js
index eb25666532..f235bd53cc 100644
---
a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/client-tests.js
+++
b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/client-tests.js
@@ -19,7 +19,7 @@
import assert from 'assert';
import Bytecode from '../../lib/process/bytecode.js';
-import { Vertex } from '../../lib/structure/graph.js';
+import { Vertex, Edge, VertexProperty } from '../../lib/structure/graph.js';
import { getClient } from '../helper.js';
import { cardinality } from '../../lib/process/traversal.js';
@@ -28,7 +28,7 @@ let client, clientCrew;
describe('Client', function () {
before(function () {
client = getClient('gmodern');
- clientCrew = helper.getClient('gcrew')
+ clientCrew = getClient('gcrew')
return client.open();
});
after(function () {
@@ -81,7 +81,7 @@ describe('Client', function () {
assert.ok(result);
assert.strictEqual(result.length, 1);
const vertex = result.first().object;
- assert.ok(vertex instanceof graphModule.Vertex);
+ assert.ok(vertex instanceof Vertex);
const age = vertex.properties.find(p => p.key === 'age');
const name = vertex.properties.find(p => p.key === 'name');
assert.ok(age);
@@ -97,7 +97,7 @@ describe('Client', function () {
assert.ok(result);
assert.strictEqual(result.length, 1);
const vertex = result.first().object;
- assert.ok(vertex instanceof graphModule.Vertex);
+ assert.ok(vertex instanceof Vertex);
assert.ok(vertex.properties.length === 0);
});
});
@@ -108,7 +108,7 @@ describe('Client', function () {
assert.ok(result);
assert.strictEqual(result.length, 1);
const vertex = result.first();
- assert.ok(vertex instanceof graphModule.Vertex);
+ assert.ok(vertex instanceof Vertex);
const age = vertex.properties.find(p => p.key === 'age');
const name = vertex.properties.find(p => p.key === 'name');
assert.ok(age);
@@ -124,7 +124,7 @@ describe('Client', function () {
assert.ok(result);
assert.strictEqual(result.length, 1);
const edge = result.first();
- assert.ok(edge instanceof graphModule.Edge);
+ assert.ok(edge instanceof Edge);
assert.strictEqual(edge.label, 'knows');
assert.strictEqual(edge.properties[0].value, 0.5);
assert.ok(edge.inV);
@@ -138,7 +138,7 @@ describe('Client', function () {
assert.ok(result);
assert.strictEqual(result.length, 1);
const prop = result.first();
- assert.ok(prop instanceof graphModule.VertexProperty);
+ assert.ok(prop instanceof VertexProperty);
assert.strictEqual(prop.key, 'location');
assert.strictEqual(prop.value, 'centreville');
@@ -157,7 +157,7 @@ describe('Client', function () {
assert.ok(result);
assert.strictEqual(result.length, 1);
const vertex = result.first();
- assert.ok(vertex instanceof graphModule.Vertex);
+ assert.ok(vertex instanceof Vertex);
assert.ok(vertex.properties.length === 0);
});
});
diff --git
a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/socket-connection-tests.js
b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/socket-connection-tests.js
index 6b80f5770f..b4ab338b36 100644
---
a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/socket-connection-tests.js
+++
b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/socket-connection-tests.js
@@ -22,10 +22,10 @@
*/
'use strict';
-const assert = require('assert');
-const http = require('http');
-const url = require('url');
-const helper = require('../helper');
+import assert from "assert";
+import http from "http";
+import url from "url";
+import * as helper from "../helper.js";
const testServerPort = 45944;
const testServer401ResponseBody = 'Invalid credentials provided';
diff --git
a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/traversal-test.js
b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/traversal-test.js
index be1b8d9f63..e7ff4c5360 100644
---
a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/traversal-test.js
+++
b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/traversal-test.js
@@ -30,7 +30,7 @@ import { SubgraphStrategy, ReadOnlyStrategy,
SeedStrategy,HaltedTraverserStrateg
OptionsStrategy, ReservedKeysVerificationStrategy,
EdgeLabelVerificationStrategy } from '../../lib/process/traversal-strategy.js';
import Bytecode from '../../lib/process/bytecode.js';
import { getConnection, getDriverRemoteConnection } from '../helper.js';
-const {getDriverRemoteConnectionGraphSON} = require("../helper");
+import * as helper from '../helper.js';
const __ = statics;
let connection;
@@ -157,7 +157,7 @@ describe('Traversal', function () {
});
});
it('should skip path element properties when tokens is set', function () {
- var g = traversal().withRemote(connection);
+ var g = anon.traversal().withRemote(connection);
return g.with_("materializeProperties",
"tokens").V().has('name','marko').outE().inV().hasLabel('software').path().next().then(function
(item) {
const p = item.value;
assert.ok(p);
@@ -174,7 +174,7 @@ describe('Traversal', function () {
});
});
it('should materialize path element properties when all is set', function
() {
- var g = traversal().withRemote(connection);
+ var g = anon.traversal().withRemote(connection);
return g.with_("materializeProperties",
"all").V().has('name','marko').outE().inV().hasLabel('software').path().next().then(function
(item) {
const p = item.value;
assert.ok(p);
@@ -291,7 +291,7 @@ describe('Traversal', function () {
return g.addV().iterate().then(() => assert.fail("should have tanked"),
(err) => assert.ok(err));
});
it('should allow OptionsStrategy', function() {
- const g = traversal().with_(connection).withStrategies(new
OptionsStrategy());
+ const g = anon.traversal().with_(connection).withStrategies(new
OptionsStrategy());
return g.V().count().next().then(function (item1) {
assert.ok(item1);
assert.strictEqual(item1.value, 6);
@@ -322,7 +322,7 @@ describe('Traversal', function () {
});
it('should allow without HaltedTraverserStrategy', function() {
const c = helper.getDriverRemoteConnectionGraphSON( 'gmodern');
- const g =
traversal().with_(c).withoutStrategies(HaltedTraverserStrategy);
+ const g =
anon.traversal().with_(c).withoutStrategies(HaltedTraverserStrategy);
return g.V().count().next().then(function (item1) {
assert.ok(item1);
assert.strictEqual(item1.value, 6);
@@ -331,7 +331,7 @@ describe('Traversal', function () {
});
it('should allow with FilterRankingStrategy', function() {
const c = helper.getDriverRemoteConnectionGraphSON( 'gmodern');
- const g = traversal().with_(c).withStrategies(new
FilterRankingStrategy());
+ const g = anon.traversal().with_(c).withStrategies(new
FilterRankingStrategy());
return g.V().out().order().dedup().count().next().then(function (item1) {
assert.ok(item1);
assert.strictEqual(item1.value, 4);