Skip to content

Commit

Permalink
adding some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nnecla committed Dec 16, 2024
1 parent 9f196b2 commit c7a9499
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 4 deletions.
10 changes: 10 additions & 0 deletions src/browser/components/ManualLink.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,16 @@ const movedPages: [
text: 'Indexes',
url: 'https://neo4j.com/docs/cypher-manual/4.3/indexes-for-search-performance/'
}
],
[
{
neo4jVersion: '2025.01.0',
page: '/administration/indexes-for-search-performance/'
},
{
text: 'Indexes',
url: 'https://neo4j.com/docs/cypher-manual/current/indexes-for-search-performance/'
}
]
]

Expand Down
16 changes: 16 additions & 0 deletions src/browser/components/VersionConditionalDoc.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,22 @@ const tests: [Omit<VersionConditionalDocProps, 'children'>, boolean][] = [
includeCurrent: false
},
true
],
[
{
neo4jVersion: '2025.03.0',
versionCondition: '>=4.3',
includeCurrent: false
},
true
],
[
{
neo4jVersion: '2025.03.0',
versionCondition: '<4.3',
includeCurrent: true
},
false
]
]

Expand Down
4 changes: 3 additions & 1 deletion src/browser/modules/Sidebar/docsUtils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ test('formatDocVersion', () => {
{ test: '1.1.0', expect: '1.1' },
{ test: '1.1.0-beta01', expect: '1.1-preview' },
{ test: '1.1.2', expect: '1.1' },
{ test: '2.1.10', expect: '2.1' }
{ test: '2.1.10', expect: '2.1' },
{ test: '2025.01.0', expect: 'current' },
{ test: '2024.11.10', expect: 'current' }
]

tests.forEach(t => expect(formatDocVersion(t.test)).toEqual(t.expect))
Expand Down
14 changes: 12 additions & 2 deletions src/browser/modules/Sidebar/static-scripts.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ describe('<Favorites />', () => {
content: !script.content.includes('Show meta-graph')
? script.content
: script.versionRange === '>=3 <4'
? script.content.replace('Show meta-graph', 'Show meta-graph v3')
: script.content.replace('Show meta-graph', 'Show meta-graph v4')
? script.content.replace('Show meta-graph', 'Show meta-graph v3')
: script.content.replace('Show meta-graph', 'Show meta-graph v4')
}))

const renderWithDBMSVersion = (version: any) => {
Expand Down Expand Up @@ -83,4 +83,14 @@ describe('<Favorites />', () => {
expect(queryByText('Show meta-graph v3')).toBeFalsy()
expect(queryByText('Show meta-graph v4')).toBeTruthy()
})

it('lists examples correctly when using calendar version', () => {
const version = '2025.01.0'
const { queryByText } = renderWithDBMSVersion(version)

fireEvent.click(queryByText('Common Procedures') as HTMLElement)

expect(queryByText('Show meta-graph v3')).toBeFalsy()
expect(queryByText('Show meta-graph v4')).toBeTruthy()
})
})
6 changes: 5 additions & 1 deletion src/shared/modules/features/featureDuck.utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ describe('guessSemverVersion', () => {
['3.5.3', '3.5.3'],
['3.5', '3.5.0'],
['3.5-test', '3.5.0'],
['4.0-aura', '4.0.0']
['4.0-aura', '4.0.0'],
['2025.01.0', '2025.1.0'],
['2025.07.15-1242', '2025.7.15-1242'],
['2025.12.1', '2025.12.1'],
['2025.1.1', '2025.1.1']
]

test.each(tests)(
Expand Down

0 comments on commit c7a9499

Please sign in to comment.