Skip to content

Commit

Permalink
feat(arangojs): upgrade to arangojs 7.0.1
Browse files Browse the repository at this point in the history
BREAKING CHANGE: arangojs 7+ has quite a few breaking changes. We've addressed the issues that look like they need to be addressed but more testing is likely necessary to make sure.
  • Loading branch information
danwkennedy committed Sep 17, 2020
1 parent a972402 commit ae3c8ff
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 28 deletions.
11 changes: 7 additions & 4 deletions edge-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class EdgeManager extends DataSource {
/**
* Creates an instance of EdgeManager.
* @param {Database} db An instance of an ArangoDb Database
* @param {EdgeCollection} collection An instance of an ArangoDb EdgeCollection
* @param {Collection} collection An instance of an ArangoDb Collection
* @memberof EdgeManager
*/
constructor(db, collection) {
Expand All @@ -30,9 +30,12 @@ class EdgeManager extends DataSource {
* @memberof EdgeManager
*/
async create(from, to, properties = {}) {
const { new: edge } = await this.collection.save(properties, from, to, {
returnNew: true,
});
const { new: edge } = await this.collection.save(
{ _from: from, _to: to, ...properties },
{
returnNew: true,
}
);
return { new: edge };
}

Expand Down
4 changes: 2 additions & 2 deletions edge-manager.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@ describe(`EdgeManager`, () => {

describe(`EdgeManager.create`, () => {
test(`it calls collection.save()`, async () => {
const doc = { name: 'abc' };
const from = 'abc';
const to = 'xyz';
const properties = { test: true };
const doc = { _from: from, _to: to, ...properties };
collectionMock.save.mockResolvedValue({ new: doc });

const output = await manager.create(from, to, properties);
expect(output).toEqual({ new: doc });
expect(collectionMock.save).toHaveBeenCalledTimes(1);
expect(collectionMock.save).toHaveBeenCalledWith(properties, from, to, {
expect(collectionMock.save).toHaveBeenCalledWith(doc, {
returnNew: true,
});
});
Expand Down
48 changes: 27 additions & 21 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"homepage": "https://github.com/danwkennedy/arango-datasouce#readme",
"dependencies": {
"apollo-datasource": "^0.7.0",
"arangojs": "^6.14.1",
"arangojs": "^7.0.1",
"dataloader": "^2.0.0",
"object-hash": "^2.0.3"
},
Expand Down

0 comments on commit ae3c8ff

Please sign in to comment.