Debian Codegraph @

packages/search/lib/commands/INFO.spec.ts

raw
1 import { strict as assert } from 'assert';
2 import { SchemaFieldTypes } from '.';
3 import testUtils, { GLOBAL } from '../test-utils';
4 import { transformArguments } from './INFO';
5
6 describe('INFO', () => {
7 it('transformArguments', () => {
8 assert.deepEqual(
9 transformArguments('index'),
10 ['FT.INFO', 'index']
11 );
12 });
13
14 testUtils.testWithClient('client.ft.info', async client => {
15 await client.ft.create('index', {
16 field: SchemaFieldTypes.TEXT
17 });
18 assert.deepEqual(
19 await client.ft.info('index'),
20 {
21 indexName: 'index',
22 indexOptions: [],
23 indexDefinition: Object.create(null, {
24 default_score: {
25 value: '1',
26 configurable: true,
27 enumerable: true
28 },
29 key_type: {
30 value: 'HASH',
31 configurable: true,
32 enumerable: true
33 },
34 prefixes: {
35 value: [''],
36 configurable: true,
37 enumerable: true
38 }
39 }),
40 attributes: [Object.create(null, {
41 identifier: {
42 value: 'field',
43 configurable: true,
44 enumerable: true
45 },
46 attribute: {
47 value: 'field',
48 configurable: true,
49 enumerable: true
50 },
51 type: {
52 value: 'TEXT',
53 configurable: true,
54 enumerable: true
55 },
56 WEIGHT: {
57 value: '1',
58 configurable: true,
59 enumerable: true
60 }
61 })],
62 numDocs: '0',
63 maxDocId: '0',
64 numTerms: '0',
65 numRecords: '0',
66 invertedSzMb: '0',
67 vectorIndexSzMb: '0',
68 totalInvertedIndexBlocks: '0',
69 offsetVectorsSzMb: '0',
70 docTableSizeMb: '0',
71 sortableValuesSizeMb: '0',
72 keyTableSizeMb: '0',
73 recordsPerDocAvg: '-nan',
74 bytesPerRecordAvg: '-nan',
75 offsetsPerTermAvg: '-nan',
76 offsetBitsPerRecordAvg: '-nan',
77 hashIndexingFailures: '0',
78 indexing: '0',
79 percentIndexed: '1',
80 gcStats: {
81 bytesCollected: '0',
82 totalMsRun: '0',
83 totalCycles: '0',
84 averageCycleTimeMs: '-nan',
85 lastRunTimeMs: '0',
86 gcNumericTreesMissed: '0',
87 gcBlocksDenied: '0'
88 },
89 cursorStats: {
90 globalIdle: 0,
91 globalTotal: 0,
92 indexCapacity: 128,
93 idnexTotal: 0
94 },
95 stopWords: undefined
96 }
97 );
98 }, GLOBAL.SERVERS.OPEN);
99 });