cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

test failing driver connect

When I try to initiate and connect with a new driver and run "npm run test 01" 

I get test fails. 

 

I checkout the git checkout 01-connect-to-neo4j  and add my uri, user, password and run npm run test 01 and it passes.  

So I copied the entire file and went back to the main branch and with the neo4j.js file removed all the content and pasted in the code that worked .    Ran it  - and it FAILED...   stuck - help 

 

7 REPLIES 7

@DrAli - Which course are you talking about specifically? Also - you mention failures, but you don't share what those failures are. Kind of hard to help...

My apologies:  you are correct  -   I left out some details 

Course is:  

Building Neo4j Applications with Node.js

set up the neo4j.js   file

in terminal    -      npm run test 01


> neoflix-api-node@0.1.0 test
> node --experimental-vm-modules node_modules/jest/bin/jest.js 01

(node:1233) ExperimentalWarning: VM Modules is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db
Why you should do it regularly: https://github.com/browserslist/browserslist#browsers-data-updating
FAIL test/challenges/01-connect-to-neo4j.spec.js
01. Initiate Driver
✓ Should create a driver instance and connect to server (1 ms)
✕ Driver has been instantiated (1 ms)
✕ Driver can verify connectivity

● 01. Initiate Driver › Driver has been instantiated

expect(received).toBeDefined()

Received: undefined

25 | it('Driver has been instantiated', () => {
26 | const driver = getDriver()
> 27 | expect(driver).toBeDefined()
| ^
28 |
29 | expect(driver.constructor.name).toEqual('Driver')
30 | })

at Object.<anonymous> (test/challenges/01-connect-to-neo4j.spec.js:27:24)

● 01. Initiate Driver › Driver can verify connectivity

expect(received).toBeDefined()

Received: undefined

32 | it('Driver can verify connectivity', () => {
33 | const driver = getDriver()
> 34 | expect(driver).toBeDefined()
| ^
35 | expect(driver.constructor.name).toEqual('Driver')
36 |
37 | driver.verifyConnectivity()

at Object.<anonymous> (test/challenges/01-connect-to-neo4j.spec.js:34:24)

Test Suites: 1 failed, 1 total
Tests: 2 failed, 1 passed, 3 total
Snapshots: 0 total
Time: 0.811 s
Ran all test suites matching /01/i.
gitpod /workspace/app-nodejs (main) $

se: 

 

 

 

 

 

@DrAli ,

Modify the connection string for the driver to match your sandbox instance as explained here:

https://graphacademy.neo4j.com/courses/app-nodejs/1-driver/2-connection-strings/

Our sandboxes are currently in the process of migrating to Neo4j 5.4 but the connection for the driver should work as it did for Neo4j 4.x.

 

I did follow those instructions. 

I just copied and pasted from the other branch - and got it to work that way.   There are differences in the code that may explain the first one failing  -  but those changes were not part of the assignment - specifically the export closeDriver function  lines 59 to 61

 

 

Can you share your neo4j.js file please?

you can only upload jpegs here -  but you can access the file if you are in the course - by using the git checkout 01-connect-to-neo4j 

You should be able to copy and paste your code into the reply window and wrap it in backticks to format it correctly.  I would like to understand what has happened in your case so I can make sure that others don't run into the same issue.