From 8368ce9c430d474b0cececf434b8750500cb2fa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20H=C3=B6ij?= Date: Sat, 26 Apr 2025 17:04:44 +0200 Subject: [PATCH 1/8] Whitespace and linting (part of #318) --- lib/query/woqlQuery.js | 20 ++++++++++---------- lib/woqlClient.js | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/query/woqlQuery.js b/lib/query/woqlQuery.js index 9e7d6aac..6470af34 100644 --- a/lib/query/woqlQuery.js +++ b/lib/query/woqlQuery.js @@ -29,14 +29,14 @@ const typedef = require('../typedef'); // I HAVE TO REVIEW THE Inheritance and the prototype chain class WOQLQuery extends WOQLCore { -/** - * defines the internal functions of the woql query object - the - * language API is defined in WOQLQuery - * @module WOQLQuery - * @constructor - * @param {object} [query] json-ld query for initialisation - * @returns {WOQLQuery} - */ + /** + * defines the internal functions of the woql query object - the + * language API is defined in WOQLQuery + * @module WOQLQuery + * @constructor + * @param {object} [query] json-ld query for initialisation + * @returns {WOQLQuery} + */ /** * Update a pattern matching rule for the triple (Subject, Predicate, oldObjValue) with the @@ -373,7 +373,7 @@ WOQLQuery.prototype.and = function (...subqueries) { const onevar = this.jobj(subqueries[i]); if ( onevar['@type'] === 'And' - && onevar.and + && onevar.and ) { for (let j = 0; j < onevar.and.length; j++) { const qjson = onevar.and[j]; @@ -1487,7 +1487,7 @@ WOQLQuery.prototype.order_by = function (...orderedVarlist) { ); } const embedquery = typeof orderedVarlist[orderedVarlist.length - 1] === 'object' - && orderedVarlist[orderedVarlist.length - 1].json + && orderedVarlist[orderedVarlist.length - 1].json ? orderedVarlist.pop() : false; diff --git a/lib/woqlClient.js b/lib/woqlClient.js index 121f6a27..57007d86 100644 --- a/lib/woqlClient.js +++ b/lib/woqlClient.js @@ -667,7 +667,7 @@ WOQLClient.prototype.query = function (woql, commitMsg, allWitnesses, lastDataVe const fileName = resourceObject.source.post.split('/').pop(); if (providedResourceInsteadOfFile) { - formData.append("file", new Blob([providedResourceInsteadOfFile], { type: "application/csv" }), fileName) + formData.append('file', new Blob([providedResourceInsteadOfFile], { type: 'application/csv' }), fileName); } else { formData.append('file', fs.createReadStream(resourceObject.source.post)); } From cc52c5078d4b1b5482f5ff65f7d47f9e3a02ebbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20H=C3=B6ij?= Date: Sat, 26 Apr 2025 17:06:07 +0200 Subject: [PATCH 2/8] Add test and fix issue with WOQL from (fixes #318) --- integration_tests/woql_regression.test.ts | 45 +++++++++++++++++++++++ lib/query/woqlQuery.js | 6 +-- test/woql.spec.js | 21 +++++++---- 3 files changed, 60 insertions(+), 12 deletions(-) create mode 100644 integration_tests/woql_regression.test.ts diff --git a/integration_tests/woql_regression.test.ts b/integration_tests/woql_regression.test.ts new file mode 100644 index 00000000..194d3703 --- /dev/null +++ b/integration_tests/woql_regression.test.ts @@ -0,0 +1,45 @@ +//@ts-check +import { describe, expect, test, beforeAll } from '@jest/globals'; +import { WOQLClient, WOQL, Vars } from '../index.js'; +import { DbDetails } from '../dist/typescript/lib/typedef.js'; + +let client: WOQLClient +const db01 = 'db__test_woql_regression'; + +beforeAll(async () => { + client = new WOQLClient("http://localhost:6363", { user: 'admin', organization: 'admin', key: process.env.TDB_ADMIN_PASS ?? 'root' }) + client.db(db01); + const dbObj: DbDetails = { label: db01, comment: 'add db', schema: true } + await client.createDatabase(db01, dbObj); +}); + +afterAll(async () => { + await client.deleteDatabase(db01); +}); + +describe('Tests for woql graph addressing', () => { + it('should construct correct query for: from instance', async () => { + const query = WOQL.from('instance').limit(10).eval(WOQL.plus(1, 1), 'v:result'); + + const expectedJson = [{ "result": { "@type": "xsd:decimal", "@value": 2 } }]; + + const result = await client.query(query); + expect(result?.bindings).toStrictEqual(expectedJson); + }); + + it('should construct correct query for: from schema', async () => { + // This tests corresponds to issue #2077, with incorrect AST, now fixed + // https://github.com/terminusdb/terminusdb/issues/2077 + let v = Vars("cls"); + const query = WOQL.from("schema") + .triple(v.cls, "rdf:type", "sys:Class") + const expectedJson = []; + const result = await client.query(query); + expect(result?.bindings).toStrictEqual(expectedJson); + }); + + test('should construct correct query for: info', async () => { + const result = await client.info(); + expect(result["@type"]).toStrictEqual("api:InfoResponse"); + }); +}); diff --git a/lib/query/woqlQuery.js b/lib/query/woqlQuery.js index 6470af34..418a2f9c 100644 --- a/lib/query/woqlQuery.js +++ b/lib/query/woqlQuery.js @@ -421,16 +421,14 @@ WOQLQuery.prototype.or = function (...subqueries) { */ WOQLQuery.prototype.from = function (graphRef, query) { - // if (graph && graph === 'args') - // return ['graph', 'query'] if (this.cursor['@type']) this.wrapCursorWithAnd(); this.cursor['@type'] = 'From'; - if (!graphRef || typeof graph !== 'string') { + if (!graphRef || typeof graphRef !== 'string') { return this.parameterError( 'The first parameter to from must be a Graph Filter Expression (string)', ); } - this.cursor.graph = graphRef; + this.cursor.graph = this.jlt(graphRef); return this.addSubQuery(query); }; diff --git a/test/woql.spec.js b/test/woql.spec.js index 88b75811..d37a8b05 100644 --- a/test/woql.spec.js +++ b/test/woql.spec.js @@ -123,22 +123,20 @@ describe('woql queries', () => { }); it('check the from method', () => { - const WOQLQuery = WOQL.limit(10); - - const woqlObjectChain = WOQL.from('http://dburl').limit(10); - const woqlObject = WOQL.from('http://dburl', WOQLQuery); + const woqlObjectChain = WOQL.from('instance/main').limit(10).and(); const jsonObj = { '@type': 'From', - graph: 'http://dburl', + graph: { + "@type": "xsd:string", + "@value": "instance/main", + }, query: { '@type': 'Limit', limit: 10, - query: {}, }, }; - // expect(woqlObject.json()).to.eql(jsonObj); - // expect(woqlObjectChain.json()).to.eql(jsonObj); + expect(woqlObjectChain.json()).to.eql(jsonObj); }); it('check the star method', () => { @@ -496,4 +494,11 @@ describe('woql queries', () => { expect(wq).to.deep.eql( {"@type":"And","and":[{"@type":"Eval","expression":{"@type":"Times","left":{"@type":"ArithmeticValue","data":{"@type":"xsd:decimal","@value":3}},"right":{"@type":"ArithmeticValue","data":{"@type":"xsd:decimal","@value":4}}},"result":{"@type":"ArithmeticValue","variable":"a"}},{"@type":"Eval","expression":{"@type":"Times","left":{"@type":"ArithmeticValue","variable":"a"},"right":{"@type":"ArithmeticValue","data":{"@type":"xsd:decimal","@value":3}}},"result":{"@type":"ArithmeticValue","variable":"res"}}]}) }); + + it('check limit().eval()', () => { + let v = Vars("result"); + const woqlObject = WOQL.limit(100).eval(WOQL.times(2, 3), v.result); + const expectedJson = {"@type":"Limit","limit":100,"query":{"@type":"Eval","expression":{"@type":"Times","left":{"@type":"ArithmeticValue","data":{"@type":"xsd:decimal","@value":2}},"right":{"@type":"ArithmeticValue","data":{"@type":"xsd:decimal","@value":3}}},"result":{"@type":"ArithmeticValue","variable":"result"}}}; + expect(woqlObject.json()).to.deep.eql(expectedJson); + }); }); From df693042051a5671cbf150eaa68e5a33c4e1eb0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20H=C3=B6ij?= Date: Mon, 28 Apr 2025 20:46:56 +0200 Subject: [PATCH 3/8] Update to supported Node.JS version 18 --- .github/workflows/ci.yml | 6 +++--- .github/workflows/docs.yml | 2 +- .github/workflows/production.yml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 75f81d90..d6530e13 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,10 +28,10 @@ jobs: if: needs.skip_if_running.outputs.skip != 'true' steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: - node-version: 14 + node-version: 18 - name: Run terminusdb server run: docker run --detach --publish 127.0.0.1:6363:6363 terminusdb/terminusdb-server:dev && sleep 3 - name: Install, build and test diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index b4b0e121..aeb73e97 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Clone JSDoc template run: git clone https://github.com/terminusdb-labs/jsdoc-terminusdb-template.git - name: Run NPM Install diff --git a/.github/workflows/production.yml b/.github/workflows/production.yml index b64133f3..d09fc004 100644 --- a/.github/workflows/production.yml +++ b/.github/workflows/production.yml @@ -10,11 +10,11 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v1 with: - node-version: 14 + node-version: 18 registry-url: 'https://registry.npmjs.org' - run: npm install - run: npm run build From e44bdfa06086e132cd3ead386cf8471877511099 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20H=C3=B6ij?= Date: Mon, 28 Apr 2025 20:53:38 +0200 Subject: [PATCH 4/8] Increase timeout of server start --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d6530e13..0f441cc2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,7 +33,7 @@ jobs: with: node-version: 18 - name: Run terminusdb server - run: docker run --detach --publish 127.0.0.1:6363:6363 terminusdb/terminusdb-server:dev && sleep 3 + run: docker run --detach --publish 127.0.0.1:6363:6363 terminusdb/terminusdb-server:dev && sleep 10 - name: Install, build and test run: | npm ci From 8ea160104286a9355f569cf5e2acb7bcbac4d7dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20H=C3=B6ij?= Date: Tue, 29 Apr 2025 06:31:48 +0200 Subject: [PATCH 5/8] Debug reason for Github Actions docker terminusdb port 6363 not answering --- .github/workflows/ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0f441cc2..397aa244 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,7 +33,10 @@ jobs: with: node-version: 18 - name: Run terminusdb server - run: docker run --detach --publish 127.0.0.1:6363:6363 terminusdb/terminusdb-server:dev && sleep 10 + run: | + docker run --detach --publish 127.0.0.1:6363:6363 terminusdb/terminusdb-server:dev && sleep 10 + docker ps + netstat -an |grep 8080 - name: Install, build and test run: | npm ci From 8381fc74960f2bb67a1a24f42755108e654bea61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20H=C3=B6ij?= Date: Tue, 29 Apr 2025 06:37:24 +0200 Subject: [PATCH 6/8] Aligned network port opening strategy with main terminusdb build --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 397aa244..b4e6d975 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,9 +34,9 @@ jobs: node-version: 18 - name: Run terminusdb server run: | - docker run --detach --publish 127.0.0.1:6363:6363 terminusdb/terminusdb-server:dev && sleep 10 + docker run --detach --net=host terminusdb/terminusdb-server:dev && sleep 10 docker ps - netstat -an |grep 8080 + netstat -an |grep 6363 - name: Install, build and test run: | npm ci From cb9f4ca2dbd5ee220067775b3f91be09a05140ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20H=C3=B6ij?= Date: Tue, 29 Apr 2025 06:50:35 +0200 Subject: [PATCH 7/8] Node 18 dns resolution order changed, making localhost ::1 that docker does not listen on --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b4e6d975..4012d1b6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,6 +37,7 @@ jobs: docker run --detach --net=host terminusdb/terminusdb-server:dev && sleep 10 docker ps netstat -an |grep 6363 + echo "127.0.0.1 localhost" >> /etc/hosts - name: Install, build and test run: | npm ci From 1baa718ada8d6aa65cec81f0e112b205077a232f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20H=C3=B6ij?= Date: Tue, 29 Apr 2025 07:00:13 +0200 Subject: [PATCH 8/8] Node 18 with github actions resolves localhost to ::1 that docker does not listen on --- .github/workflows/ci.yml | 3 +-- integration_tests/create_database.test.ts | 4 ++-- integration_tests/woql_arithmetic.test.ts | 4 ++-- integration_tests/woql_client.test.ts | 4 ++-- integration_tests/woql_regression.test.ts | 2 +- lib/accessControl.js | 2 +- test/accessControl.spec.js | 2 +- test/connectionConfing.spec.js | 28 +++++++++++------------ test/createDatabase.spec.js | 2 +- test/getSchema.spec.js | 6 ++--- test/helper.spec.js | 2 +- test/utils.spec.js | 2 +- 12 files changed, 30 insertions(+), 31 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4012d1b6..23d42cf7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,10 +34,9 @@ jobs: node-version: 18 - name: Run terminusdb server run: | - docker run --detach --net=host terminusdb/terminusdb-server:dev && sleep 10 + docker run --detach --publish 127.0.0.1:6363:6363 terminusdb/terminusdb-server:dev && sleep 10 docker ps netstat -an |grep 6363 - echo "127.0.0.1 localhost" >> /etc/hosts - name: Install, build and test run: | npm ci diff --git a/integration_tests/create_database.test.ts b/integration_tests/create_database.test.ts index 47abec9b..0d474ac5 100644 --- a/integration_tests/create_database.test.ts +++ b/integration_tests/create_database.test.ts @@ -7,10 +7,10 @@ import { DbDetails, DocParamsGet } from '../dist/typescript/lib/typedef'; import schemaJson from './persons_schema' //console.log(typeof schemaJson) -let client : WOQLClient //= new WOQLClient('http://localhost:6363'); +let client : WOQLClient //= new WOQLClient('http://127.0.0.1:6363'); beforeAll(() => { - client = new WOQLClient("http://localhost:6363",{ user: 'admin', organization: 'admin', key: process.env.TDB_ADMIN_PASS ?? 'root' }) + client = new WOQLClient("http://127.0.0.1:6363",{ user: 'admin', organization: 'admin', key: process.env.TDB_ADMIN_PASS ?? 'root' }) }); const db01 = 'db__test'; diff --git a/integration_tests/woql_arithmetic.test.ts b/integration_tests/woql_arithmetic.test.ts index b53df9fb..1ac52b96 100644 --- a/integration_tests/woql_arithmetic.test.ts +++ b/integration_tests/woql_arithmetic.test.ts @@ -4,11 +4,11 @@ import { WOQLClient, WOQL } from '../index.js'; import { DbDetails } from '../dist/typescript/lib/typedef.js'; import { Vars } from '../lib/woql.js'; -let client: WOQLClient //= new WOQLClient('http://localhost:6363'); +let client: WOQLClient //= new WOQLClient('http://127.0.0.1:6363'); const db01 = 'db__test_woql_arithmetic'; beforeAll(() => { - client = new WOQLClient("http://localhost:6363", { user: 'admin', organization: 'admin', key: process.env.TDB_ADMIN_PASS ?? 'root' }) + client = new WOQLClient("http://127.0.0.1:6363", { user: 'admin', organization: 'admin', key: process.env.TDB_ADMIN_PASS ?? 'root' }) client.db(db01); }); diff --git a/integration_tests/woql_client.test.ts b/integration_tests/woql_client.test.ts index 0e75c56a..1b73061d 100644 --- a/integration_tests/woql_client.test.ts +++ b/integration_tests/woql_client.test.ts @@ -6,10 +6,10 @@ import schemaJson from './persons_schema' import { mock_employees_limit_1 } from './data/employees_limit1'; import fs from 'fs'; -let client: WOQLClient //= new WOQLClient('http://localhost:6363'); +let client: WOQLClient //= new WOQLClient('http://127.0.0.1:6363'); beforeAll(() => { - client = new WOQLClient("http://localhost:6363", { user: 'admin', organization: 'admin', key: process.env.TDB_ADMIN_PASS ?? 'root' }) + client = new WOQLClient("http://127.0.0.1:6363", { user: 'admin', organization: 'admin', key: process.env.TDB_ADMIN_PASS ?? 'root' }) }); const db01 = 'db__test_woql'; diff --git a/integration_tests/woql_regression.test.ts b/integration_tests/woql_regression.test.ts index 194d3703..c7e7d52b 100644 --- a/integration_tests/woql_regression.test.ts +++ b/integration_tests/woql_regression.test.ts @@ -7,7 +7,7 @@ let client: WOQLClient const db01 = 'db__test_woql_regression'; beforeAll(async () => { - client = new WOQLClient("http://localhost:6363", { user: 'admin', organization: 'admin', key: process.env.TDB_ADMIN_PASS ?? 'root' }) + client = new WOQLClient("http://127.0.0.1:6363", { user: 'admin', organization: 'admin', key: process.env.TDB_ADMIN_PASS ?? 'root' }) client.db(db01); const dbObj: DbDetails = { label: db01, comment: 'add db', schema: true } await client.createDatabase(db01, dbObj); diff --git a/lib/accessControl.js b/lib/accessControl.js index d005a6a1..dc8b3a47 100644 --- a/lib/accessControl.js +++ b/lib/accessControl.js @@ -38,7 +38,7 @@ const typedef = require('./typedef'); * eTFORUd.......") * * //connect with the base authentication this type of connection is only for the local installation - * const accessContol = new AccessControl("http://localhost:6363", + * const accessContol = new AccessControl("http://127.0.0.1:6363", * {organization:"my_team_name", user:"admin" * key:"mykey"}) * accessControl.getOrgUsers().then(result=>{ diff --git a/test/accessControl.spec.js b/test/accessControl.spec.js index e6875363..d8ac8afd 100644 --- a/test/accessControl.spec.js +++ b/test/accessControl.spec.js @@ -2,7 +2,7 @@ const { expect } = require('chai'); const AccessControl = require('../lib/accessControl'); describe('AccessControl tests', () => { - const startServerUrl = 'http://localhost:6363/'; + const startServerUrl = 'http://127.0.0.1:6363/'; const organization = 'admin'; const user = 'admin'; const key ='mykey' diff --git a/test/connectionConfing.spec.js b/test/connectionConfing.spec.js index 94d2ed90..5a4e8d25 100644 --- a/test/connectionConfing.spec.js +++ b/test/connectionConfing.spec.js @@ -2,7 +2,7 @@ const { expect } = require('chai'); const ConnectionConfig = require('../lib/connectionConfig'); describe('connectionConfig tests', () => { - const startServerUrl = 'http://localhost:6363/'; + const startServerUrl = 'http://127.0.0.1:6363/'; const startDBid = 'testDB'; const organization = 'admin'; const params = { @@ -10,7 +10,7 @@ describe('connectionConfig tests', () => { }; const connectionConfig = new ConnectionConfig(startServerUrl, params); - const dbURL = 'http://localhost:6363/api/db/admin/testDB'; + const dbURL = 'http://127.0.0.1:6363/api/db/admin/testDB'; it('check get server URL', () => { expect(connectionConfig.serverURL()).to.equal(startServerUrl); @@ -22,7 +22,7 @@ describe('connectionConfig tests', () => { it('check set branch', () => { connectionConfig.setBranch('myBranch'); - const queryURLBranch = 'http://localhost:6363/api/woql/admin/testDB/local/branch/myBranch'; + const queryURLBranch = `${startServerUrl}api/woql/admin/testDB/local/branch/myBranch`; /* * the dbURL dosen't change */ @@ -33,7 +33,7 @@ describe('connectionConfig tests', () => { it('check set refId', () => { connectionConfig.setRef('gfhfjkflfgorpyuiioo'); - const queryURL = 'http://localhost:6363/api/woql/admin/testDB/local/commit/gfhfjkflfgorpyuiioo'; + const queryURL = `${startServerUrl}api/woql/admin/testDB/local/commit/gfhfjkflfgorpyuiioo`; expect(connectionConfig.queryURL()).to.equal(queryURL); }); @@ -42,7 +42,7 @@ describe('connectionConfig tests', () => { * get the schema in owl turtle encoding */ it('check set class tripleUrl', () => { - const classTripleURL = 'http://localhost:6363/api/triples/admin/testDB/local/commit/gfhfjkflfgorpyuiioo/schema/main'; + const classTripleURL = `${startServerUrl}api/triples/admin/testDB/local/commit/gfhfjkflfgorpyuiioo/schema/main`; // console.log(JSON.stringify(connectionConfig.triplesURL(), null, 4)); @@ -50,9 +50,9 @@ describe('connectionConfig tests', () => { }); it('check remove the refCommit', () => { - const queryUrlBranch01 = 'http://localhost:6363/api/woql/admin/testDB/local/branch/myBranch'; - // const queryFrameBranch01 = 'http://localhost:6363/api/frame/admin/testDB/local/branch/myBranch' - const queryTriplesBranch01 = 'http://localhost:6363/api/triples/admin/testDB/local/branch/myBranch/schema/main'; + const queryUrlBranch01 = `${startServerUrl}api/woql/admin/testDB/local/branch/myBranch`; + // const queryFrameBranch01 = `${startServerUrl}api/frame/admin/testDB/local/branch/myBranch` + const queryTriplesBranch01 = `${startServerUrl}api/triples/admin/testDB/local/branch/myBranch/schema/main`; /* *remove the ref commit it come to the */ @@ -65,7 +65,7 @@ describe('connectionConfig tests', () => { }); it('check set branch', () => { - const optimizeUrl = 'http://localhost:6363/api/optimize/admin/testDB/local/branch/%23%23branch01'; + const optimizeUrl = `${startServerUrl}api/optimize/admin/testDB/local/branch/%23%23branch01`; /* * the dbURL dosen't change */ @@ -73,9 +73,9 @@ describe('connectionConfig tests', () => { }); it('check remove the branch', () => { - const queryUrlBranch01 = 'http://localhost:6363/api/woql/admin/testDB/local/branch/main'; - // const queryFrameBranch01 = 'http://localhost:6363/api/frame/admin/testDB/local/branch/main' - const queryTriplesBranch01 = 'http://localhost:6363/api/triples/admin/testDB/local/branch/main/instance/main'; + const queryUrlBranch01 = `${startServerUrl}api/woql/admin/testDB/local/branch/main`; + // const queryFrameBranch01 = `${startServerUrl}api/frame/admin/testDB/local/branch/main` + const queryTriplesBranch01 = `${startServerUrl}api/triples/admin/testDB/local/branch/main/instance/main`; /* *remove the ref commit it come to the */ @@ -269,7 +269,7 @@ describe('connectionConfig tests', () => { it('check baseUrlEncode', function() { const db = "%6277&ˆˆˆ@ˆˆWˆTWTET#Y@&&GHHSHHS" connectionConfig.setDB(db) - const dbBase = 'http://localhost:6363/api/woql/123/%256277%26%CB%86%CB%86%CB%86@%CB%86%CB%86W%CB%86TWTET%23Y@%26%26GHHSHHS' + const dbBase = `${startServerUrl}api/woql/123/%256277%26%CB%86%CB%86%CB%86@%CB%86%CB%86W%CB%86TWTET%23Y@%26%26GHHSHHS`; expect(connectionConfig.dbBase('woql')).to.equal(dbBase) expect(connectionConfig.db()).to.equal(db) @@ -296,7 +296,7 @@ describe('connectionConfig tests', () => { //serverUrlEncoding - //const startServerUrl = 'http://localhost:6363/' + //const startServerUrl = 'http://127.0.0.1:6363/' //const startDBid = 'testDB' //const organization = 'admin' diff --git a/test/createDatabase.spec.js b/test/createDatabase.spec.js index a1540efc..b50a4671 100644 --- a/test/createDatabase.spec.js +++ b/test/createDatabase.spec.js @@ -15,7 +15,7 @@ describe('create new db tests', () => { .stub(axiosInstance, 'post') .returns(Promise.resolve({ status: 200, data: { 'system:status': 'system:success' } })); - expect(global.client.connectionConfig.serverURL()).to.equal('http://localhost:6363/'); + expect(global.client.connectionConfig.serverURL()).to.equal('http://127.0.0.1:6363/'); global.client .createDatabase(dbid, doc, organizationid) .then((response) => { diff --git a/test/getSchema.spec.js b/test/getSchema.spec.js index 3efc9464..d39689a3 100644 --- a/test/getSchema.spec.js +++ b/test/getSchema.spec.js @@ -2,8 +2,8 @@ const { expect } = require('chai'); const turtleSchemaR = require('./extraFile/getSchemaTurtleResponse'); const axiosInstance = require('../lib/axiosInstance'); -// http://localhost:6363/triples/terminus/schema/main -// http://localhost:6363/triples/admin/testDB/local/commit/gfhfjkflfgorpyuiioo +// http://127.0.0.1:6363/triples/terminus/schema/main +// http://127.0.0.1:6363/triples/admin/testDB/local/commit/gfhfjkflfgorpyuiioo describe('get a terminusDB schema', () => { const dbID = 'second_database'; @@ -14,7 +14,7 @@ describe('get a terminusDB schema', () => { expect(global.client.connectionConfig.server).to.equal(global.url); // console.log(JSON.stringify(global.client.connectionConfig.triplesURL('schema'), null, 4)); - const schemaURL = 'http://localhost:6363/api/triples/organization01/second_database/local/branch/main/schema/main'; + const schemaURL = 'http://127.0.0.1:6363/api/triples/organization01/second_database/local/branch/main/schema/main'; expect(global.client.connectionConfig.triplesURL('schema')).to.equal(schemaURL); }); diff --git a/test/helper.spec.js b/test/helper.spec.js index 3227cc5b..1e6e3d5c 100644 --- a/test/helper.spec.js +++ b/test/helper.spec.js @@ -7,7 +7,7 @@ const CONNECT_RESPONSE = require('./serverResponse/connectResponseForCapabilitie before((done) => { console.log('before all test'); - global.url = 'http://localhost:6363/'; + global.url = 'http://127.0.0.1:6363/'; const key = 'root'; global.sandbox = sinon.createSandbox(); global.sandbox diff --git a/test/utils.spec.js b/test/utils.spec.js index 94a4e616..d7ebd8e5 100644 --- a/test/utils.spec.js +++ b/test/utils.spec.js @@ -2,7 +2,7 @@ const { expect } = require('chai'); const UTILS = require('../lib/utils.js'); describe('utils tests', () => { - const servURL = 'http://localhost:6363/'; + const servURL = 'http://127.0.0.1:6363/'; it('check standard urls', () => { expect(UTILS.standard_urls.rdf).to.equal(UTILS.getStdURL('rdf', ''));