Skip to content

Commit c5c8633

Browse files
#RI-5131 - fix test
1 parent ca51be7 commit c5c8633

File tree

1 file changed

+8
-20
lines changed

1 file changed

+8
-20
lines changed

redisinsight/ui/src/pages/browser/components/virtual-tree/VirtualTree.spec.tsx

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const mockedItems = [
1616
},
1717
]
1818

19-
export const mockVirtualTreeResult = [{
19+
const mockTreeItem = {
2020
children: [{
2121
children: [],
2222
fullName: 'car:110:',
@@ -30,34 +30,22 @@ export const mockVirtualTreeResult = [{
3030
keyApproximate: 47.18,
3131
keyCount: 4718,
3232
name: 'car',
33-
},
34-
{
33+
}
34+
35+
const mockTreeItem2 = {
3536
children: [],
3637
fullName: 'test',
3738
id: '0.snc1rc3zwg1o',
3839
keyApproximate: 0.01,
3940
keyCount: 1,
4041
name: 'test',
41-
}]
42+
}
4243

43-
export const mockVirtualTreeResult1 = [{
44-
children: [{
45-
children: [],
46-
fullName: 'car:110:',
47-
id: '0.snc1rc3zwgo',
48-
keyApproximate: 0.01,
49-
keyCount: 1,
50-
name: '110',
51-
}],
52-
fullName: 'car:',
53-
id: '0.sz1ie1koqi8',
54-
keyApproximate: 47.18,
55-
keyCount: 4718,
56-
name: 'car',
57-
}]
44+
export const mockVirtualTreeResult = [mockTreeItem, mockTreeItem2]
5845

5946
jest.mock('uiSrc/services', () => ({
6047
...jest.requireActual('uiSrc/services'),
48+
__esModule: true,
6149
useDisposableWebworker: jest.fn(() => ({ result: mockVirtualTreeResult, run: jest.fn() }))
6250
}))
6351

@@ -94,7 +82,7 @@ describe('VirtualTree', () => {
9482

9583
it('should call onStatusOpen if only one folder is exist', () => {
9684
(useDisposableWebworker as jest.Mock).mockReturnValueOnce({
97-
result: mockVirtualTreeResult1,
85+
result: [mockTreeItem],
9886
run: jest.fn()
9987
})
10088
const mockFn = jest.fn()

0 commit comments

Comments
 (0)