Skip to content
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

Support new Neo4j types (Neo4j 3.4) #735

Merged
merged 13 commits into from
Apr 23, 2018
Merged

Conversation

oskarhane
Copy link
Member

@oskarhane oskarhane commented Apr 16, 2018

This PR adds support for the new Neo4j types:

  Point,
  Date,
  DateTime,
  Duration,
  LocalDateTime,
  LocalTime,
  Time

This also removes the driver mock we used to have. It's getting tiresome to keep up the interface changes. No need to mock.

It formats point types as seen in the screenshots. Temporal types are .toString() formatted.
E2E tests are added (couldn't add unit tests because detached driver didn't output something testable).

oskarhane-mbpt 2018-04-22 at 21 37 27

oskarhane-mbpt 2018-04-22 at 21 37 16

@oskarhane
Copy link
Member Author

I'm leaving this PR as it is and will create a task to display types of all returned objects

@oskarhane oskarhane force-pushed the new-types-support branch 2 times, most recently from ac1dcc8 to 2238de3 Compare April 18, 2018 08:13
- Format new type `Point` correctly and add e2e test.
- Format Number that are not neo4j ints as float (always ass `.0` at the end to signal that.
- Update tests that failed because of number formatting changes.

Use new formatting function in both table view and ascii view
@oskarhane
Copy link
Member Author

oskarhane commented Apr 22, 2018

Formatting of types in output tables are now added and added screenshots to PR description.

it('presents the point type correctly', () => {
cy.executeCommand(':clear')
const query =
"WITH point({{}crs: 'wgs-84', longitude: 12.78, latitude: 56.7}) as p1 RETURN p1"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the {} here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Escape syntax for {. Test framework specific.

it('presents the point type correctly', () => {
cy.executeCommand(':clear')
const query =
"WITH point({{}crs: 'wgs-84', longitude: 12.78, latitude: 56.7}) as p1 RETURN p1"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't point({{}crs be point({crs (without additional {}). I also see the tests pass with this approach.

Am I missing something as to why this passes?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try it :)
When you "type" things in cypress we have to escape "{" because it's a special character. And this is how you escape it.
In the tests you see that it types what we want it to type.

it('presents temporal types correctly', () => {
cy.executeCommand(':clear')
const query =
'RETURN datetime({{}year:2015, month:7, day:20, hour:15, minute:11, second:42, timezone:"Europe/Stockholm"}) AS t1'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional {}

Create convenience method `cy.resultContains `
cy.get(SubmitQueryButton).click()
})
Cypress.Commands.add('waitForCommandResult', () => {
cy
.get('[data-test-id="frame-loaded-contents"]', { timeout: 40000 })
.should('be.visible')
})
Cypress.Commands.add('resultContains', str => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Contributor

@pe4cey pe4cey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@pe4cey pe4cey merged commit 4f06173 into neo4j:master Apr 23, 2018
@oskarhane oskarhane deleted the new-types-support branch April 23, 2018 10:39
@oskarhane oskarhane changed the title Support new Neo4j types Support new Neo4j types (Neo4j 3.4) Apr 25, 2018
myzero1 pushed a commit to myzero1/neo4j-browser that referenced this pull request May 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants