Skip to content

Commit

Permalink
Merge pull request #189 from jamesfer/update-dependencies
Browse files Browse the repository at this point in the history
Update non-breaking dependencies
  • Loading branch information
jamesfer authored Feb 17, 2024
2 parents 2be2b23 + d67c004 commit 0e43fb4
Show file tree
Hide file tree
Showing 5 changed files with 2,611 additions and 2,238 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
]
},
"dependencies": {
"@types/lodash": "^4.14.136",
"@types/lodash": "^4.14.202",
"@types/node": "^12.6.1",
"lodash": "^4.17.15",
"neo4j-driver": "^4.1.2",
Expand Down Expand Up @@ -123,6 +123,6 @@
"tslint": "^5.18.0",
"tslint-config-airbnb": "^5.11.1",
"typedoc": "^0.15.3",
"typescript": "^3.5.3"
"typescript": "^4.9.5"
}
}
8 changes: 6 additions & 2 deletions scripts/test-integration
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
#!/usr/bin/env bash

NEO4J_URL=bolt://localhost
NEO4J_USER=neo4j
NEO4J_PASS=admin1234

start-neo4j() {
docker run \
-d \
--rm \
-p 7474:7474 \
-p 7687:7687 \
-e NEO4J_AUTH=neo4j/admin \
-e NEO4J_AUTH="$NEO4J_USER/$NEO4J_PASS" \
"neo4j:${NEO4J_VERSION-latest}"
}

Expand All @@ -28,7 +32,7 @@ id=$(start-neo4j) || exit 1

# Run the tests
echo "Running tests..."
NEO4J_URL=bolt://localhost NEO4J_USER=neo4j NEO4J_PASS=admin run-tests "$@"
NEO4J_URL="$NEO4J_URL" NEO4J_USER="$NEO4J_USER" NEO4J_PASS="$NEO4J_PASS" run-tests "$@"
code="$?"

# Stop the container
Expand Down
31 changes: 18 additions & 13 deletions src/query.spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Dictionary, each } from 'lodash';
import { spy, stub } from 'sinon';
import { expect } from '../test-setup';
import { mockConnection } from '../tests/connection.mock';
import { ClauseCollection } from './clause-collection';
import { node, NodePattern } from './clauses';
import { Query } from './query';
import { Observable } from 'rxjs';
import { Connection } from './connection';

describe('Query', () => {
describe('query methods', () => {
Expand Down Expand Up @@ -86,10 +86,10 @@ describe('Query', () => {
});

it('should run the query on its connection', () => {
const { connection } = mockConnection();
const connection = makeConnection();
const runStub = stub(connection, 'run');
runStub.returns(Promise.resolve([{}]));
const query = (new Query(connection)).raw('Query');
const query = new Query(connection).raw('Query');
return expect(query.run()).to.be.fulfilled.then(() => {
expect(runStub.calledOnce);
});
Expand All @@ -111,9 +111,9 @@ describe('Query', () => {
});

it('should run the query on its connection', () => {
const { connection } = mockConnection();
const connection = makeConnection();
const streamStub = stub(connection, 'stream');
const query = (new Query(connection)).raw('Query');
const query = new Query(connection).raw('Query');
query.stream();
expect(streamStub.calledOnce);
});
Expand All @@ -126,28 +126,33 @@ describe('Query', () => {
});

it('should run the query on its connection and return the first result', () => {
const { connection } = mockConnection();
const runStub = stub(connection, 'run');
const connection = makeConnection();
const firstRecord = { number: 1 };
runStub.returns(Promise.resolve([firstRecord, { number: 2 }, { number: 3 }]));
const runStub = stub(connection, 'run')
.returns(Promise.resolve([firstRecord, { number: 2 }, { number: 3 }]));

const query = (new Query(connection)).raw('Query');
const query = new Query(connection).raw('Query');
return expect(query.first()).to.be.fulfilled.then((result: any) => {
expect(runStub.calledOnce);
expect(result).to.equal(firstRecord);
});
});

it('should return undefined if the query returns no results', () => {
const { connection } = mockConnection();
const runStub = stub(connection, 'run');
runStub.returns(Promise.resolve([]));
const connection = makeConnection();
const runStub = stub(connection, 'run').returns(Promise.resolve([]));

const query = (new Query(connection)).raw('Query');
const query = new Query(connection).raw('Query');
return expect(query.first()).to.be.fulfilled.then((result: any) => {
expect(runStub.calledOnce);
expect(result).to.equal(undefined);
});
});
});

function makeConnection(): Connection {
const url = 'bolt://localhost';
const credentials = { username: 'neo4j', password: 'admin1234' };
return new Connection(url, credentials);
}
});
30 changes: 0 additions & 30 deletions tests/connection.mock.ts

This file was deleted.

Loading

0 comments on commit 0e43fb4

Please sign in to comment.