Skip to content

Add Integer to typescript exported types #483

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions test/types/v1/graph-types.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const node1String: string = node1.toString()
const node1Id: Integer = node1.identity
const node1Labels: string[] = node1.labels
const node1Props: object = node1.properties
const isNode1: boolean = node1 instanceof Node

const node2: Node<number> = new Node(2, ['Person', 'Employee'], {
name: 'Alice'
Expand All @@ -46,6 +47,7 @@ const rel1Start: Integer = rel1.start
const rel1End: Integer = rel1.end
const rel1Type: string = rel1.type
const rel1Props: object = rel1.properties
const isRel1: boolean = rel1 instanceof Relationship

const rel2: UnboundRelationship = new UnboundRelationship(int(1), 'KNOWS', {
since: 12345
Expand All @@ -55,13 +57,15 @@ const rel3: Relationship = rel2.bind(int(1), int(2))
const rel2Id: Integer = rel2.identity
const rel2Type: string = rel2.type
const rel2Props: object = rel2.properties
const isRel2: boolean = rel2 instanceof UnboundRelationship

const rel4: Relationship<number> = new Relationship(2, 3, 4, 'KNOWS', {
since: 12345
})
const rel4Id: number = rel4.identity
const rel4Start: number = rel4.start
const rel4End: number = rel4.end
const isRel4: boolean = rel4 instanceof Relationship

const rel5: UnboundRelationship<number> = new UnboundRelationship(5, 'KNOWS', {
since: 12345
Expand All @@ -71,11 +75,13 @@ const rel6 = rel5.bind(24, 42)
const rel6Id: number = rel6.identity
const rel6Start: number = rel6.start
const rel6End: number = rel6.end
const isRel6: boolean = rel6 instanceof UnboundRelationship

const pathSegment1: PathSegment = new PathSegment(node1, rel1, node1)
const pathSegment1Start: Node = pathSegment1.start
const pathSegment1Rel: Relationship = pathSegment1.relationship
const pathSegment1End: Node = pathSegment1.end
const isPathSegment1: boolean = pathSegment1 instanceof PathSegment

const pathSegment2: PathSegment<number> = new PathSegment(node2, rel4, node2)
const pathSegment2Start: Node<number> = pathSegment2.start
Expand All @@ -87,8 +93,10 @@ const path1Start: Node = path1.start
const path1End: Node = path1.end
const path1Segments: PathSegment[] = path1.segments
const path1Length: number = path1.length
const isPath1: boolean = path1 instanceof Path

const path2: Path<number> = new Path(node2, node2, [pathSegment2])
const path2Start: Node<number> = path2.start
const path2End: Node<number> = path2.end
const path2Segments: PathSegment<number>[] = path2.segments
const isPath2: boolean = path2 instanceof Path
4 changes: 4 additions & 0 deletions test/types/v1/integer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ const int1 = new Integer()
const int2 = new Integer(1)
const int3 = new Integer(1, 2)

const isInt1 = int1 instanceof Integer
const isInt2 = int2 instanceof Integer
const isInt3 = int3 instanceof Integer

const high: number = int1.high
const low: number = int1.low

Expand Down
2 changes: 2 additions & 0 deletions test/types/v1/record.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import Record from '../../../types/v1/record'

const record1 = new Record(['name', 'age'], ['Alice', 20])
const record2 = new Record(['name', 'age'], ['Bob', 22], { key: 'value' })
const isRecord1: boolean = record1 instanceof Record
const isRecord2: boolean = record2 instanceof Record

const record1Keys: string[] = record1.keys
const record1Length: number = record1.length
Expand Down
4 changes: 4 additions & 0 deletions test/types/v1/spatial-types.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,27 @@ const point1: Point = new Point(int(1), 2, 3)
const srid1: Integer = point1.srid
const x1: number = point1.x
const y1: number = point1.y
const isInstance1: boolean = point1 instanceof Point

const point2: Point<number> = new Point(1, 2, 3)
const srid2: number = point2.srid
const x2: number = point2.x
const y2: number = point2.y
const isInstance2: boolean = point2 instanceof Point

const point3: Point = new Point(int(1), 2, 3, 4)
const srid3: Integer = point3.srid
const x3: number = point3.x
const y3: number = point3.y
const z3: number | undefined = point3.z
const isInstance3: boolean = point3 instanceof Point

const point4: Point<number> = new Point(1, 2, 3, 4)
const srid4: number = point4.srid
const x4: number = point4.x
const y4: number = point4.y
const z4: number | undefined = point4.z
const isInstance4: boolean = point4 instanceof Point

const isPoint1: boolean = isPoint(point1)
const isPoint2: boolean = isPoint({})
16 changes: 16 additions & 0 deletions test/types/v1/temporal-types.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,48 +39,56 @@ const months1: Integer = duration1.months
const days1: Integer = duration1.days
const seconds1: Integer = duration1.seconds
const nanoseconds1: Integer = duration1.nanoseconds
const durationIsInstance1: boolean = duration1 instanceof Duration

const duration2: Duration<number> = new Duration(1, 1, 1, 1)
const months2: number = duration2.months
const days2: number = duration2.days
const seconds2: number = duration2.seconds
const nanoseconds2: number = duration2.nanoseconds
const durationIsInstance2: boolean = duration2 instanceof Duration

const localTime1: LocalTime = new LocalTime(int(1), int(1), int(1), int(1))
const localTime1Hour1: Integer = localTime1.hour
const localTime1Minute1: Integer = localTime1.minute
const localTime1Second1: Integer = localTime1.second
const localTime1Nanosecond1: Integer = localTime1.nanosecond
const localTimeIsInstance1: boolean = localTime1 instanceof LocalTime

const localTime2: LocalTime<number> = new LocalTime(1, 1, 1, 1)
const localTime2Hour1: number = localTime2.hour
const localTime2Minute1: number = localTime2.minute
const localTime2Second1: number = localTime2.second
const localTime2Nanosecond1: number = localTime2.nanosecond
const localTimeIsInstance2: boolean = localTime2 instanceof LocalTime

const time1: Time = new Time(int(1), int(1), int(1), int(1), int(1))
const offset1: Integer = time1.timeZoneOffsetSeconds
const hour1: Integer = time1.hour
const minute1: Integer = time1.minute
const second1: Integer = time1.second
const nanosecond1: Integer = time1.nanosecond
const timeIsInstance1: boolean = time1 instanceof Time

const time2: Time<number> = new Time(1, 1, 1, 1, 1)
const offset2: number = time2.timeZoneOffsetSeconds
const hour2: number = time2.hour
const minute2: number = time2.minute
const second2: number = time2.second
const nanosecond2: number = time2.nanosecond
const timeIsInstance2: boolean = time2 instanceof Time

const date1: Date = new Date(int(1), int(1), int(1))
const date1Year1: Integer = date1.year
const date1Month1: Integer = date1.month
const date1Day1: Integer = date1.day
const dateIsInstance1: boolean = date1 instanceof Date

const date2: Date<number> = new Date(1, 1, 1)
const date2Year1: number = date2.year
const date2Month1: number = date2.month
const date2Day1: number = date2.day
const dateIsInstance2: boolean = date2 instanceof Date

const localDateTime1: LocalDateTime = new LocalDateTime(
int(1),
Expand All @@ -98,6 +106,8 @@ const hour3: Integer = localDateTime1.hour
const minute3: Integer = localDateTime1.minute
const second3: Integer = localDateTime1.second
const nanosecond3: Integer = localDateTime1.nanosecond
const localDateTimeIsInstance1: boolean =
localDateTime1 instanceof LocalDateTime

const localDateTime2: LocalDateTime<number> = new LocalDateTime(
1,
Expand All @@ -115,6 +125,8 @@ const hour4: number = localDateTime2.hour
const minute4: number = localDateTime2.minute
const second4: number = localDateTime2.second
const nanosecond4: number = localDateTime2.nanosecond
const localDateTimeIsInstance2: boolean =
localDateTime2 instanceof LocalDateTime

const dateTime1: DateTime = new DateTime(
int(1),
Expand All @@ -136,6 +148,7 @@ const hour5: Integer = dateTime1.hour
const minute5: Integer = dateTime1.minute
const second5: Integer = dateTime1.second
const nanosecond5: Integer = dateTime1.nanosecond
const dateTimeIsInstance1: boolean = dateTime1 instanceof DateTime

const dateTime2: DateTime<number> = new DateTime(
1,
Expand All @@ -157,6 +170,7 @@ const hour6: number = dateTime2.hour
const minute6: number = dateTime2.minute
const second6: number = dateTime2.second
const nanosecond6: number = dateTime2.nanosecond
const dateTimeIsInstance2: boolean = dateTime2 instanceof DateTime

const dateTime3: DateTime = new DateTime(
int(1),
Expand All @@ -178,6 +192,7 @@ const hour7: Integer = dateTime3.hour
const minute7: Integer = dateTime3.minute
const second7: Integer = dateTime3.second
const nanosecond7: Integer = dateTime3.nanosecond
const dateTimeIsInstance3: boolean = dateTime3 instanceof DateTime

const dateTime4: DateTime<number> = new DateTime(
1,
Expand All @@ -199,6 +214,7 @@ const hour8: number = dateTime4.hour
const minute8: number = dateTime4.minute
const second8: number = dateTime4.second
const nanosecond8: number = dateTime4.nanosecond
const dateTimeIsInstance4: boolean = dateTime4 instanceof DateTime

const isDurationValue: boolean = isDuration(duration1)
const isLocalTimeValue: boolean = isLocalTime(localTime1)
Expand Down
1 change: 1 addition & 0 deletions types/v1/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ declare const types: {
Date: typeof Date
LocalDateTime: typeof LocalDateTime
DateTime: typeof DateTime
Integer: typeof Integer
}

declare const session: {
Expand Down