From e050fdddb2cca27a9b2b1b1f6aa7cd84ef0fa01f Mon Sep 17 00:00:00 2001 From: Oskar Hane Date: Tue, 9 Jun 2020 16:38:10 +0200 Subject: [PATCH] Make sure we present large integers correctly + add tests --- e2e_tests/integration/types.spec.js | 15 +++++++++++++-- .../modules/Stream/CypherFrame/relatable-view.jsx | 6 +++++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/e2e_tests/integration/types.spec.js b/e2e_tests/integration/types.spec.js index c37d6b49922..52693713aec 100644 --- a/e2e_tests/integration/types.spec.js +++ b/e2e_tests/integration/types.spec.js @@ -26,12 +26,23 @@ describe('Types in Browser', () => { .title() .should('include', 'Neo4j Browser') cy.wait(3000) - }) - it('can connect', () => { const password = Cypress.config('password') cy.connect('neo4j', password) }) if (Cypress.config('serverVersion') >= 3.4) { + it('presents large integers correctly', () => { + cy.executeCommand(':clear') + const query = 'RETURN 2467500000 AS bigNumber' + cy.executeCommand(query) + cy.waitForCommandResult() + cy.resultContains('2467500000') + + // Go to ascii view + cy.get('[data-testid="cypherFrameSidebarAscii"]') + .first() + .click() + cy.resultContains('│2467500000') + }) it('presents the point type correctly', () => { cy.executeCommand(':clear') const query = diff --git a/src/browser/modules/Stream/CypherFrame/relatable-view.jsx b/src/browser/modules/Stream/CypherFrame/relatable-view.jsx index f5be4a1990e..1d036b7d355 100644 --- a/src/browser/modules/Stream/CypherFrame/relatable-view.jsx +++ b/src/browser/modules/Stream/CypherFrame/relatable-view.jsx @@ -48,7 +48,7 @@ import ClickableUrls, { import { StyledStatsBar, StyledTruncatedMessage } from '../styled' import Ellipsis from '../../../components/Ellipsis' import { RelatableStyleWrapper, StyledJsonPre } from './relatable-view.styled' -import { isPoint } from 'neo4j-driver' +import { isPoint, isInt } from 'neo4j-driver' const RelatableView = connect(state => ({ maxRows: getMaxRows(state), @@ -108,6 +108,10 @@ function CypherCell({ cell }) { ) const mapped = mapper(value) + if (isInt(value)) { + return value.toString() + } + if (Number.isInteger(value)) { return `${value}.0` }