1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-07 13:22:56 +03:00

small refactor per discussion with leibele (#2801)

* small refactor per discussion with leibele

* move true type to boolean type

* fix geoshape to support NOINDEX & SORTABLE, clean code

* fix for last commit

---------

Co-authored-by: Leibale Eidelman <me@leibale.com>
This commit is contained in:
Shaya Potter
2024-07-29 16:27:53 +03:00
committed by GitHub
parent 179b9e0094
commit 840ec57fb9
2 changed files with 76 additions and 73 deletions

View File

@@ -70,6 +70,18 @@ describe('CREATE', () => {
['FT.CREATE', 'index', 'SCHEMA', 'field', 'TEXT', 'WITHSUFFIXTRIE']
);
});
it('with INDEXEMPTY', () => {
assert.deepEqual(
transformArguments('index', {
field: {
type: SchemaFieldTypes.TEXT,
INDEXEMPTY: true
}
}),
['FT.CREATE', 'index', 'SCHEMA', 'field', 'TEXT', 'INDEXEMPTY']
);
});
});
it('NUMERIC', () => {
@@ -148,6 +160,18 @@ describe('CREATE', () => {
['FT.CREATE', 'index', 'SCHEMA', 'field', 'TAG', 'WITHSUFFIXTRIE']
);
});
it('with INDEXEMPTY', () => {
assert.deepEqual(
transformArguments('index', {
field: {
type: SchemaFieldTypes.TAG,
INDEXEMPTY: true
}
}),
['FT.CREATE', 'index', 'SCHEMA', 'field', 'TAG', 'INDEXEMPTY']
);
});
});
describe('VECTOR', () => {
@@ -282,6 +306,18 @@ describe('CREATE', () => {
['FT.CREATE', 'index', 'SCHEMA', 'field', 'TEXT', 'NOINDEX']
);
});
it('with INDEXMISSING', () => {
assert.deepEqual(
transformArguments('index', {
field: {
type: SchemaFieldTypes.TEXT,
INDEXMISSING: true
}
}),
['FT.CREATE', 'index', 'SCHEMA', 'field', 'TEXT', 'INDEXMISSING']
);
});
});
});
@@ -441,36 +477,6 @@ describe('CREATE', () => {
);
});
});
describe('Missing Values', () => {
it('with INDEXEMPTY', () => {
assert.deepEqual(
transformArguments('index', {
field: {
type: SchemaFieldTypes.TEXT,
MISSING_VALUES: {
INDEXEMPTY: true
}
}
}),
['FT.CREATE', 'index', 'SCHEMA', 'field', 'TEXT', 'INDEXEMPTY']
);
});
it('with INDEXMISSING', () => {
assert.deepEqual(
transformArguments('index', {
field: {
type: SchemaFieldTypes.TEXT,
MISSING_VALUES: {
INDEXMISSING: true
}
}
}),
['FT.CREATE', 'index', 'SCHEMA', 'field', 'TEXT', 'INDEXMISSING']
);
});
});
});
testUtils.testWithClient('client.ft.create', async client => {