Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Ignores folders covered with custom linters configs
redisinsight/api
tests
tests/e2e

# Logs
logs
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { parseSearchRawResponse, parseInfoRawResponse, parseAggregateRawResponse } from '../';
import { parseSearchRawResponse, parseInfoRawResponse, parseAggregateRawResponse } from '..'

const resultFTSearch: any[] = [
'red:2',
Expand All @@ -23,27 +23,27 @@ const resultFTSearch: any[] = [
'visits',
'108',
],
];
]

const resultFTSearchNoContent: any[] = ['red:2', 'red:3', 'red:4', 'red:5', 'red:6'];
const resultFTSearchNoContent: any[] = ['red:2', 'red:3', 'red:4', 'red:5', 'red:6']

describe('parseSearchRawResponse', () => {
it('command "get" should return result is not modified 1', () => {
const command = 'get';
const result: any[] = [];
const command = 'get'
const result: any[] = []

expect(parseSearchRawResponse(command, result)).toEqual(result);
});
expect(parseSearchRawResponse(command, result)).toEqual(result)
})

it('command "get" should return result is not modified 2', () => {
const command = 'get';
const command = 'get'
const result: any = []

expect(parseSearchRawResponse(command, result)).toEqual(result);
});
expect(parseSearchRawResponse(command, result)).toEqual(result)
})

it('command "ft.search" should return array with parsed object', () => {
const command = 'ft.search';
const command = 'ft.search'
const parsedResultFTSearch = [
{
Doc: 'red:2',
Expand All @@ -59,13 +59,13 @@ describe('parseSearchRawResponse', () => {
url: '<https://redis.com/primary-caching>',
visits: '108',
},
];
]

expect(parseSearchRawResponse(command, resultFTSearch)).toEqual(parsedResultFTSearch);
});
expect(parseSearchRawResponse(command, resultFTSearch)).toEqual(parsedResultFTSearch)
})

it('command "ft.search" with attr NOCONTENT should return array of doc names', () => {
const command = 'ft.search NOCONTENT';
const command = 'ft.search NOCONTENT'
const parsedResultFTSearch = [
{
Doc: 'red:2',
Expand All @@ -82,19 +82,17 @@ describe('parseSearchRawResponse', () => {
{
Doc: 'red:6',
},
];
]

expect(parseSearchRawResponse(command, resultFTSearchNoContent)).toEqual(parsedResultFTSearch);
});


});
expect(parseSearchRawResponse(command, resultFTSearchNoContent)).toEqual(parsedResultFTSearch)
})
})

describe('parseAggregateRawResponse', () => {
it('command "ft.aggregate" should return array of array with objects count of docs ', () => {
const command = 'ft.aggregate';
const resultFTAggregate = [[], [], [], [], []];
const command = 'ft.aggregate'
const resultFTAggregate = [[], [], [], [], []]

expect(parseAggregateRawResponse(resultFTAggregate)).toEqual(resultFTAggregate);
});
});
expect(parseAggregateRawResponse(resultFTAggregate)).toEqual(resultFTAggregate)
})
})
Loading