Skip to content

Commit

Permalink
Import only from root package in neo4j-driver
Browse files Browse the repository at this point in the history
+ bump drivers in package tests
  • Loading branch information
oskarhane committed May 27, 2021
1 parent dda2561 commit 61e3381
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 13 deletions.
6 changes: 3 additions & 3 deletions packages/graphql/src/schema/scalars/DateTime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
*/

import { GraphQLScalarType } from "graphql";
import { DateTime as Neo4jDateTime } from "neo4j-driver/lib/temporal-types";
import neo4j from "neo4j-driver";

export default new GraphQLScalarType({
name: "DateTime",
description: "A date and time, represented as an ISO-8601 string",
serialize: (value: Neo4jDateTime) => {
serialize: (value: typeof neo4j.types.DateTime) => {
return new Date(value.toString()).toISOString();
},
parseValue: (value: string) => {
return Neo4jDateTime.fromStandardDate(new Date(value));
return neo4j.types.DateTime.fromStandardDate(new Date(value));
},
});
20 changes: 14 additions & 6 deletions packages/graphql/tests/integration/types/datetime.int.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
*/

import camelCase from "camelcase";
import { Driver } from "neo4j-driver";
import { DateTime } from "neo4j-driver/lib/temporal-types";
import neo4jDriver, { Driver } from "neo4j-driver";
import { graphql } from "graphql";
import { generate } from "randomstring";
import pluralize from "pluralize";
Expand Down Expand Up @@ -82,7 +81,10 @@ describe("DateTime", () => {
RETURN m {.id, .datetime} as m
`);

const movie: { id: string; datetime: DateTime } = (result.records[0].toObject() as any).m;
const movie: {
id: string;
datetime: typeof neo4jDriver.types.DateTime;
} = (result.records[0].toObject() as any).m;

expect(movie.id).toEqual(id);
expect(new Date(movie.datetime.toString()).toISOString()).toEqual(date.toISOString());
Expand Down Expand Up @@ -135,7 +137,10 @@ describe("DateTime", () => {
RETURN m {.id, .datetimes} as m
`);

const movie: { id: string; datetimes: DateTime[] } = (result.records[0].toObject() as any).m;
const movie: {
id: string;
datetimes: typeof neo4jDriver.types.DateTime[];
} = (result.records[0].toObject() as any).m;

expect(movie.id).toEqual(id);

Expand Down Expand Up @@ -178,7 +183,7 @@ describe("DateTime", () => {
}
`;

const nDateTime = DateTime.fromStandardDate(date);
const nDateTime = neo4jDriver.types.DateTime.fromStandardDate(date);

try {
await session.run(
Expand Down Expand Up @@ -303,7 +308,10 @@ describe("DateTime", () => {
RETURN m {.id, .datetime} as m
`);

const movie: { id: string; datetime: DateTime } = (result.records[0].toObject() as any).m;
const movie: {
id: string;
datetime: typeof neo4jDriver.types.DateTime;
} = (result.records[0].toObject() as any).m;

expect(movie.id).toEqual(id);
expect(new Date(movie.datetime.toString()).toISOString()).toEqual(date.toISOString());
Expand Down
2 changes: 1 addition & 1 deletion packages/package-tests/apollo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@neo4j/graphql": "file:./package",
"apollo-server": "^2.19.0",
"graphql": "^15.4.0",
"neo4j-driver": "^4.2.0",
"neo4j-driver": "^4.3.0",
"node-fetch": "^2.6.1"
}
}
2 changes: 1 addition & 1 deletion packages/package-tests/babel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"dependencies": {
"@neo4j/graphql": "file:./package",
"graphql": "^15.4.0",
"neo4j-driver": "^4.2.0"
"neo4j-driver": "^4.3.0"
},
"devDependencies": {
"@babel/core": "^7.12.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/package-tests/commonjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
"dependencies": {
"@neo4j/graphql": "file:./package",
"graphql": "^15.4.0",
"neo4j-driver": "^4.2.0"
"neo4j-driver": "^4.3.0"
}
}
2 changes: 1 addition & 1 deletion packages/package-tests/typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"dependencies": {
"@neo4j/graphql": "file:./package",
"graphql": "^15.4.0",
"neo4j-driver": "^4.2.0"
"neo4j-driver": "^4.3.0"
},
"devDependencies": {
"typescript": "3.9.7"
Expand Down

0 comments on commit 61e3381

Please sign in to comment.