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

Fix displaying large integers in new table correctly #1116

Merged
merged 1 commit into from
Jun 10, 2020
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
15 changes: 13 additions & 2 deletions e2e_tests/integration/types.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
6 changes: 5 additions & 1 deletion src/browser/modules/Stream/CypherFrame/relatable-view.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -108,6 +108,10 @@ function CypherCell({ cell }) {
)
const mapped = mapper(value)

if (isInt(value)) {
return value.toString()
}

if (Number.isInteger(value)) {
return `${value}.0`
}
Expand Down