fix: pipeline

This commit is contained in:
2023-05-31 15:30:25 +02:00
parent 68400f2480
commit 45444d9373
31 changed files with 74 additions and 120 deletions

View File

@@ -31,7 +31,7 @@ import {buildQuery} from '../../../src/storage/elasticsearch/query/query.js';
import {buildSort} from '../../../src/storage/elasticsearch/query/sort.js';
import {ElasticsearchConfig} from '../../../src/storage/elasticsearch/types/elasticsearch-config.js';
import {QueryDslSpecificQueryContainer} from '../../../src/storage/elasticsearch/types/util.js';
import {SortCombinations} from '@elastic/elasticsearch/lib/api/types.js';
import {QueryDslRangeQuery, SortCombinations} from '@elastic/elasticsearch/lib/api/types.js';
import {backendConfig} from '../../../src/config.js';
describe('Query', function () {
@@ -363,8 +363,10 @@ describe('Query', function () {
const filter = buildFilter(rawFilter) as QueryDslSpecificQueryContainer<'range'>;
expect(filter).to.deep.equal(expectedFilter);
for (const bound of ['g', 'l']) {
const inclusiveExists = typeof filter.range.price[`${bound}t`] !== 'undefined';
const exclusiveExists = typeof filter.range.price[`${bound}te`] !== 'undefined';
const inclusiveExists =
typeof filter.range.price?.[`${bound}t` as keyof QueryDslRangeQuery] !== 'undefined';
const exclusiveExists =
typeof filter.range.price?.[`${bound}te` as keyof QueryDslRangeQuery] !== 'undefined';
// only one should exist at the same time
expect(inclusiveExists && exclusiveExists).to.be.false;