Skip to content

Commit 388156c

Browse files
committed
fix tests
1 parent dee54a2 commit 388156c

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

redisinsight/ui/src/pages/browser/modules/key-details/components/hash-details/hash-details-table/HashDetailsTable.spec.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,17 +113,17 @@ describe('HashDetailsTable', () => {
113113

114114
it('edit button should be disabled if data was compressed', async () => {
115115
const defaultState = jest.requireActual('uiSrc/slices/browser/hash').initialState
116-
const hashDataSelectorMock = jest.fn().mockReturnValue({
116+
const hashDataSelectorMock = jest.fn().mockReturnValueOnce({
117117
...defaultState,
118118
total: 1,
119119
key: '123zxczxczxc',
120120
fields: [
121121
{ field: anyToBuffer(GZIP_COMPRESSED_VALUE_1), value: anyToBuffer(GZIP_COMPRESSED_VALUE_2) },
122122
]
123123
});
124-
(hashDataSelector as jest.Mock).mockImplementation(hashDataSelectorMock);
124+
(hashDataSelector as jest.Mock).mockImplementationOnce(hashDataSelectorMock);
125125

126-
(connectedInstanceSelector as jest.Mock).mockImplementation(() => ({
126+
(connectedInstanceSelector as jest.Mock).mockImplementationOnce(() => ({
127127
compressor: KeyValueCompressor.GZIP,
128128
}))
129129

@@ -149,7 +149,7 @@ describe('HashDetailsTable', () => {
149149
const afterRenderActions = [...store.getActions()]
150150

151151
await act(() => {
152-
fireEvent.click(screen.getByTestId('edit-hash-button-2'))
152+
fireEvent.click(screen.queryAllByTestId(/edit-hash-button/)[0])
153153
})
154154

155155
expect(store.getActions()).toEqual([

redisinsight/ui/src/pages/browser/modules/key-details/components/list-details/list-details-table/ListDetailsTable.spec.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,16 +110,16 @@ describe('ListDetailsTable', () => {
110110

111111
it('edit button should be disabled if data was compressed', async () => {
112112
const defaultState = jest.requireActual('uiSrc/slices/browser/list').initialState
113-
const listDataSelectorMock = jest.fn().mockReturnValue({
113+
const listDataSelectorMock = jest.fn().mockReturnValueOnce({
114114
...defaultState,
115115
key: '123zxczxczxc',
116116
elements: [
117117
{ element: anyToBuffer(GZIP_COMPRESSED_VALUE_1), index: 0 },
118118
]
119119
});
120-
(listDataSelector as jest.Mock).mockImplementation(listDataSelectorMock);
120+
(listDataSelector as jest.Mock).mockImplementationOnce(listDataSelectorMock);
121121

122-
(connectedInstanceSelector as jest.Mock).mockImplementation(() => ({
122+
(connectedInstanceSelector as jest.Mock).mockImplementationOnce(() => ({
123123
compressor: KeyValueCompressor.GZIP,
124124
}))
125125

redisinsight/ui/src/pages/browser/modules/key-details/components/string-details/StringDetails.spec.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,13 @@ describe('StringDetails', () => {
5858
})
5959

6060
it('should not be able to change value (long string not fully load)', () => {
61-
const stringDataSelectorMock = jest.fn().mockReturnValue({
61+
const stringDataSelectorMock = jest.fn().mockReturnValueOnce({
6262
value: {
6363
type: 'Buffer',
6464
data: [49, 50, 51],
6565
}
6666
});
67-
(stringDataSelector as jest.Mock).mockImplementation(stringDataSelectorMock)
67+
(stringDataSelector as jest.Mock).mockImplementationOnce(stringDataSelectorMock)
6868

6969
render(
7070
<StringDetails
@@ -77,10 +77,10 @@ describe('StringDetails', () => {
7777
})
7878

7979
it('should not be able to change value (compressed)', () => {
80-
const stringSelectorMock = jest.fn().mockReturnValue({
80+
const stringSelectorMock = jest.fn().mockReturnValueOnce({
8181
isCompressed: true
8282
});
83-
(stringSelector as jest.Mock).mockImplementation(stringSelectorMock)
83+
(stringSelector as jest.Mock).mockImplementationOnce(stringSelectorMock)
8484

8585
render(
8686
<StringDetails

0 commit comments

Comments
 (0)