Skip to content

Commit 8e63dca

Browse files
authored
Fix breaking version check on 3.6 (#1045)
* Fix breaking version check on 3.6 * Update tests
1 parent 04a22aa commit 8e63dca

File tree

3 files changed

+67
-58
lines changed

3 files changed

+67
-58
lines changed

src/browser/modules/Stream/SchemaFrame.jsx

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ import Directives from 'browser-components/Directives'
3939
import { NEO4J_BROWSER_USER_ACTION_QUERY } from 'services/bolt/txMetadata'
4040

4141
const Indexes = ({ indexes, neo4jVersion }) => {
42-
if (semver.satisfies(neo4jVersion, '<4.0.0-rc01')) {
42+
if (
43+
!semver.valid(neo4jVersion) ||
44+
semver.satisfies(neo4jVersion, '<4.0.0-rc01')
45+
) {
4346
const rows = indexes.map(index => [
4447
`${replace(index.description, 'INDEX', '')} ${toUpper(index.state)} ${
4548
index.type === 'node_unique_property'
@@ -195,9 +198,10 @@ export class SchemaFrame extends Component {
195198
render() {
196199
const { neo4jVersion } = this.props
197200
const { indexes, constraints } = this.state
198-
const schemaCommand = semver.satisfies(neo4jVersion, '<=3.4.*')
199-
? 'CALL db.schema()'
200-
: 'CALL db.schema.visualization'
201+
const schemaCommand =
202+
semver.valid(neo4jVersion) && semver.satisfies(neo4jVersion, '<=3.4.*')
203+
? 'CALL db.schema()'
204+
: 'CALL db.schema.visualization'
201205

202206
const frame = (
203207
<Slide>
@@ -231,4 +235,9 @@ const mapStateToProps = state => ({
231235
neo4jVersion: getVersion(state)
232236
})
233237

234-
export default withBus(connect(mapStateToProps, null)(Frame))
238+
export default withBus(
239+
connect(
240+
mapStateToProps,
241+
null
242+
)(Frame)
243+
)

src/browser/modules/Stream/SchemaFrame.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ test('SchemaFrame renders empty', () => {
4040
expect(container).toMatchSnapshot()
4141
})
4242

43-
test('SchemaFrame renders empty for Neo4j < 4.0', () => {
43+
test('SchemaFrame renders empty for Neo4j >= 4.0', () => {
4444
const indexResult = { records: [] }
4545
const { container } = renderWithRedux(
46-
<SchemaFrame indexes={indexResult} neo4jVersion={'3.5.13'} />
46+
<SchemaFrame indexes={indexResult} neo4jVersion={'4.0.0-rc1'} />
4747
)
4848

4949
expect(container).toMatchSnapshot()

src/browser/modules/Stream/__snapshots__/SchemaFrame.test.js.snap

Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -18,37 +18,7 @@ exports[`SchemaFrame renders empty 1`] = `
1818
<th
1919
class="DataTables__StyledTh-bf850j-2 ikUpyS table-header"
2020
>
21-
Index Name
22-
</th>
23-
<th
24-
class="DataTables__StyledTh-bf850j-2 ikUpyS table-header"
25-
>
26-
Type
27-
</th>
28-
<th
29-
class="DataTables__StyledTh-bf850j-2 ikUpyS table-header"
30-
>
31-
Uniqueness
32-
</th>
33-
<th
34-
class="DataTables__StyledTh-bf850j-2 ikUpyS table-header"
35-
>
36-
EntityType
37-
</th>
38-
<th
39-
class="DataTables__StyledTh-bf850j-2 ikUpyS table-header"
40-
>
41-
LabelsOrTypes
42-
</th>
43-
<th
44-
class="DataTables__StyledTh-bf850j-2 ikUpyS table-header"
45-
>
46-
Properties
47-
</th>
48-
<th
49-
class="DataTables__StyledTh-bf850j-2 ikUpyS table-header"
50-
>
51-
State
21+
Indexes
5222
</th>
5323
</tr>
5424
</thead>
@@ -61,24 +31,6 @@ exports[`SchemaFrame renders empty 1`] = `
6131
>
6232
None
6333
</td>
64-
<td
65-
class="DataTables__StyledTd-bf850j-3 lfnTDs table-properties"
66-
/>
67-
<td
68-
class="DataTables__StyledTd-bf850j-3 lfnTDs table-properties"
69-
/>
70-
<td
71-
class="DataTables__StyledTd-bf850j-3 lfnTDs table-properties"
72-
/>
73-
<td
74-
class="DataTables__StyledTd-bf850j-3 lfnTDs table-properties"
75-
/>
76-
<td
77-
class="DataTables__StyledTd-bf850j-3 lfnTDs table-properties"
78-
/>
79-
<td
80-
class="DataTables__StyledTd-bf850j-3 lfnTDs table-properties"
81-
/>
8234
</tr>
8335
</tbody>
8436
</table>
@@ -130,7 +82,7 @@ exports[`SchemaFrame renders empty 1`] = `
13082
</div>
13183
`;
13284

133-
exports[`SchemaFrame renders empty for Neo4j < 4.0 1`] = `
85+
exports[`SchemaFrame renders empty for Neo4j >= 4.0 1`] = `
13486
<div>
13587
<div
13688
style="width: 100%;"
@@ -148,7 +100,37 @@ exports[`SchemaFrame renders empty for Neo4j < 4.0 1`] = `
148100
<th
149101
class="DataTables__StyledTh-bf850j-2 ikUpyS table-header"
150102
>
151-
Indexes
103+
Index Name
104+
</th>
105+
<th
106+
class="DataTables__StyledTh-bf850j-2 ikUpyS table-header"
107+
>
108+
Type
109+
</th>
110+
<th
111+
class="DataTables__StyledTh-bf850j-2 ikUpyS table-header"
112+
>
113+
Uniqueness
114+
</th>
115+
<th
116+
class="DataTables__StyledTh-bf850j-2 ikUpyS table-header"
117+
>
118+
EntityType
119+
</th>
120+
<th
121+
class="DataTables__StyledTh-bf850j-2 ikUpyS table-header"
122+
>
123+
LabelsOrTypes
124+
</th>
125+
<th
126+
class="DataTables__StyledTh-bf850j-2 ikUpyS table-header"
127+
>
128+
Properties
129+
</th>
130+
<th
131+
class="DataTables__StyledTh-bf850j-2 ikUpyS table-header"
132+
>
133+
State
152134
</th>
153135
</tr>
154136
</thead>
@@ -161,6 +143,24 @@ exports[`SchemaFrame renders empty for Neo4j < 4.0 1`] = `
161143
>
162144
None
163145
</td>
146+
<td
147+
class="DataTables__StyledTd-bf850j-3 lfnTDs table-properties"
148+
/>
149+
<td
150+
class="DataTables__StyledTd-bf850j-3 lfnTDs table-properties"
151+
/>
152+
<td
153+
class="DataTables__StyledTd-bf850j-3 lfnTDs table-properties"
154+
/>
155+
<td
156+
class="DataTables__StyledTd-bf850j-3 lfnTDs table-properties"
157+
/>
158+
<td
159+
class="DataTables__StyledTd-bf850j-3 lfnTDs table-properties"
160+
/>
161+
<td
162+
class="DataTables__StyledTd-bf850j-3 lfnTDs table-properties"
163+
/>
164164
</tr>
165165
</tbody>
166166
</table>

0 commit comments

Comments
 (0)