You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@age.apache.org by jg...@apache.org on 2023/03/02 19:22:52 UTC

[age] branch master updated: Implemented CI test for nodejs driver (#720)

This is an automated email from the ASF dual-hosted git repository.

jgemignani pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/age.git


The following commit(s) were added to refs/heads/master by this push:
     new b09160fd Implemented CI test for nodejs driver (#720)
b09160fd is described below

commit b09160fdde0506327ef9cc4073159ec06112f380
Author: Muhammad Taha Naveed <mn...@seecs.edu.pk>
AuthorDate: Fri Mar 3 00:22:46 2023 +0500

    Implemented CI test for nodejs driver (#720)
    
    * Modify nodejs driver tests
    
    - Modified connection params to connect with running docker instance.
    - Fixed failing tests by modifying the expected outcomes.
    
    * Include asf header as key/value to avoid EJSONPARSE error
    
    - "//" key will never be used by npm for any purpose,
      and is reserved for comments.
    
    * Implement CI test for nodejs driver
---
 .github/workflows/nodejs-driver.yaml | 36 ++++++++++++++++++++++
 drivers/docker-compose.yml           |  2 +-
 drivers/nodejs/package.json          | 37 +++++++++++-----------
 drivers/nodejs/test/index.test.ts    | 59 ++++++++++++++++++++++++------------
 4 files changed, 94 insertions(+), 40 deletions(-)

diff --git a/.github/workflows/nodejs-driver.yaml b/.github/workflows/nodejs-driver.yaml
new file mode 100644
index 00000000..f812e2c3
--- /dev/null
+++ b/.github/workflows/nodejs-driver.yaml
@@ -0,0 +1,36 @@
+name: Nodejs Driver Tests
+
+on:
+  push:
+    branches: [ "master", "PG11" ]
+
+  pull_request:
+    branches: [ "master", "PG11" ]
+
+jobs:
+  build:
+    runs-on: ubuntu-latest
+
+    defaults:
+      run:
+        working-directory: drivers/nodejs/
+  
+    steps:
+    - uses: actions/checkout@v3
+    
+    - name: Run apache/age docker image
+      run: docker-compose up -d
+
+    - name: Set up Node
+      uses: actions/setup-node@v3
+      with:
+        node-version: latest
+
+    - name: Install dependencies
+      run: npm install
+
+    - name: Build
+      run: npm run build
+
+    - name: Test
+      run: npm test
\ No newline at end of file
diff --git a/drivers/docker-compose.yml b/drivers/docker-compose.yml
index 668eb19d..8bdf0031 100644
--- a/drivers/docker-compose.yml
+++ b/drivers/docker-compose.yml
@@ -1,7 +1,7 @@
 version: "3.3"
 services:
   db:
-    image: apache/age
+    image: apache/age:latest
     environment:
       - POSTGRES_USER=postgres
       - POSTGRES_PASSWORD=agens
diff --git a/drivers/nodejs/package.json b/drivers/nodejs/package.json
index db385eef..9f88bc2b 100644
--- a/drivers/nodejs/package.json
+++ b/drivers/nodejs/package.json
@@ -1,23 +1,22 @@
-/*
- * 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.
- */
-
 {
+  "//": [
+    "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."
+  ],
   "name": "pg-age",
   "version": "1.0.0-alpha",
   "main": "dist/index.js",
diff --git a/drivers/nodejs/test/index.test.ts b/drivers/nodejs/test/index.test.ts
index 60f9e2fe..ea386dda 100644
--- a/drivers/nodejs/test/index.test.ts
+++ b/drivers/nodejs/test/index.test.ts
@@ -24,8 +24,8 @@ const config = {
   user: 'postgres',
   host: '127.0.0.1',
   database: 'postgres',
-  password: 'postgres',
-  port: 25432
+  password: 'agens',
+  port: 5432
 }
 
 const testGraphName = 'age-test'
@@ -59,25 +59,44 @@ describe('Pre-connected Connection', () => {
             $$) as (a agtype);
         `)!
     expect(results.rows).toStrictEqual(
-      [{
-        a: {
-          id: 844424930131969,
-          label: 'Part',
-          properties: { part_num: '123' }
+      [
+        {
+          a : new Map(Object.entries({
+            id: 844424930131969,
+            label: 'Part',
+            properties: new Map(Object.entries({
+              part_num: '123'
+            }))
+          })),
+        },
+        {
+          a : new Map(Object.entries({
+            id: 844424930131970,
+            label: 'Part',
+            properties: new Map(Object.entries({
+              part_num: '345'
+            }))
+          })),
+        },
+        {
+          a : new Map(Object.entries({
+            id: 844424930131971,
+            label: 'Part',
+            properties: new Map(Object.entries({
+              part_num: '456'
+            }))
+          })),
+        },
+        {
+          a : new Map(Object.entries({
+            id: 844424930131972,
+            label: 'Part',
+            properties: new Map(Object.entries({
+              part_num: '789'
+            }))
+          })),
         }
-      }, {
-        a: {
-          id: 844424930131970,
-          label: 'Part',
-          properties: { part_num: '345' }
-        }
-      }, {
-        a: {
-          id: 844424930131971,
-          label: 'Part',
-          properties: { part_num: '456' }
-        }
-      }, { a: { id: 844424930131972, label: 'Part', properties: { part_num: '789' } } }]
+      ]
     )
   })
 })