Skip to content

Commit cef1d17

Browse files
committed
* #RIVS-258 - Change analytics page text for vscode
* #RIVS-245 - [Regression] Cli does not connect to the database when opened for the first time * #RIVS-247 - [Regression] Invalid database is displayed for some period of time after installing the extension
1 parent ce73a41 commit cef1d17

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed
Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,22 @@
11
import React from 'react'
22

3-
import { render } from 'testSrc/helpers'
3+
import * as useCertificates from 'uiSrc/store'
4+
import { constants, render } from 'testSrc/helpers'
45
import { EditDatabasePage } from './EditDatabasePage'
56

7+
vi.spyOn(useCertificates, 'fetchCerts')
8+
beforeEach(() => {
9+
vi.stubGlobal('ri', { })
10+
})
11+
612
describe('EditDatabasePage', () => {
713
it('should render', () => {
814
expect(render(<EditDatabasePage />)).toBeTruthy()
915
})
16+
17+
it('should call fetchCerts', () => {
18+
vi.stubGlobal('ri', { database: constants.DATABASE, keyInfo: { key: constants.KEY_NAME_1 } })
19+
expect(render(<EditDatabasePage />)).toBeTruthy()
20+
expect(useCertificates.fetchCerts).toBeCalled()
21+
})
1022
})

src/webviews/src/pages/EditDatabasePage/EditDatabasePage.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
1-
import React, { FC } from 'react'
1+
import React, { FC, useEffect } from 'react'
22
import { DatabasePanel } from 'uiSrc/modules'
3-
import { useDatabasesStore } from 'uiSrc/store'
3+
import { fetchCerts, fetchEditedDatabase, useDatabasesStore } from 'uiSrc/store'
44

55
export const EditDatabasePage: FC<any> = () => {
66
const database = useDatabasesStore((state) => state.editDatabase)
77

8+
useEffect(() => {
9+
const { database } = window.ri
10+
fetchCerts(() => {
11+
fetchEditedDatabase(database!)
12+
})
13+
}, [])
14+
815
return (
916
<div className="flex h-full w-full p-4 overflow-x-auto flex-col" data-testid="panel-view-page">
1017
<DatabasePanel editMode editedDatabase={database} />

0 commit comments

Comments
 (0)