Skip to content

Commit c7a9499

Browse files
committed
adding some tests
1 parent 9f196b2 commit c7a9499

File tree

5 files changed

+46
-4
lines changed

5 files changed

+46
-4
lines changed

src/browser/components/ManualLink.test.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,16 @@ const movedPages: [
109109
text: 'Indexes',
110110
url: 'https://neo4j.com/docs/cypher-manual/4.3/indexes-for-search-performance/'
111111
}
112+
],
113+
[
114+
{
115+
neo4jVersion: '2025.01.0',
116+
page: '/administration/indexes-for-search-performance/'
117+
},
118+
{
119+
text: 'Indexes',
120+
url: 'https://neo4j.com/docs/cypher-manual/current/indexes-for-search-performance/'
121+
}
112122
]
113123
]
114124

src/browser/components/VersionConditionalDoc.test.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,22 @@ const tests: [Omit<VersionConditionalDocProps, 'children'>, boolean][] = [
4646
includeCurrent: false
4747
},
4848
true
49+
],
50+
[
51+
{
52+
neo4jVersion: '2025.03.0',
53+
versionCondition: '>=4.3',
54+
includeCurrent: false
55+
},
56+
true
57+
],
58+
[
59+
{
60+
neo4jVersion: '2025.03.0',
61+
versionCondition: '<4.3',
62+
includeCurrent: true
63+
},
64+
false
4965
]
5066
]
5167

src/browser/modules/Sidebar/docsUtils.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ test('formatDocVersion', () => {
2626
{ test: '1.1.0', expect: '1.1' },
2727
{ test: '1.1.0-beta01', expect: '1.1-preview' },
2828
{ test: '1.1.2', expect: '1.1' },
29-
{ test: '2.1.10', expect: '2.1' }
29+
{ test: '2.1.10', expect: '2.1' },
30+
{ test: '2025.01.0', expect: 'current' },
31+
{ test: '2024.11.10', expect: 'current' }
3032
]
3133

3234
tests.forEach(t => expect(formatDocVersion(t.test)).toEqual(t.expect))

src/browser/modules/Sidebar/static-scripts.test.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ describe('<Favorites />', () => {
3535
content: !script.content.includes('Show meta-graph')
3636
? script.content
3737
: script.versionRange === '>=3 <4'
38-
? script.content.replace('Show meta-graph', 'Show meta-graph v3')
39-
: script.content.replace('Show meta-graph', 'Show meta-graph v4')
38+
? script.content.replace('Show meta-graph', 'Show meta-graph v3')
39+
: script.content.replace('Show meta-graph', 'Show meta-graph v4')
4040
}))
4141

4242
const renderWithDBMSVersion = (version: any) => {
@@ -83,4 +83,14 @@ describe('<Favorites />', () => {
8383
expect(queryByText('Show meta-graph v3')).toBeFalsy()
8484
expect(queryByText('Show meta-graph v4')).toBeTruthy()
8585
})
86+
87+
it('lists examples correctly when using calendar version', () => {
88+
const version = '2025.01.0'
89+
const { queryByText } = renderWithDBMSVersion(version)
90+
91+
fireEvent.click(queryByText('Common Procedures') as HTMLElement)
92+
93+
expect(queryByText('Show meta-graph v3')).toBeFalsy()
94+
expect(queryByText('Show meta-graph v4')).toBeTruthy()
95+
})
8696
})

src/shared/modules/features/featureDuck.utils.test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ describe('guessSemverVersion', () => {
2929
['3.5.3', '3.5.3'],
3030
['3.5', '3.5.0'],
3131
['3.5-test', '3.5.0'],
32-
['4.0-aura', '4.0.0']
32+
['4.0-aura', '4.0.0'],
33+
['2025.01.0', '2025.1.0'],
34+
['2025.07.15-1242', '2025.7.15-1242'],
35+
['2025.12.1', '2025.12.1'],
36+
['2025.1.1', '2025.1.1']
3337
]
3438

3539
test.each(tests)(

0 commit comments

Comments
 (0)