Skip to content

Commit ab70f30

Browse files
committed
More refactoring
1 parent a1d5bc6 commit ab70f30

File tree

3 files changed

+9
-11
lines changed

3 files changed

+9
-11
lines changed

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { strict as assert } from 'node:assert';
2-
import testUtils, { GLOBAL, skipTest } from '../test-utils';
2+
import testUtils, { GLOBAL } from '../test-utils';
33
import { FT_AGGREGATE_STEPS } from './AGGREGATE';
44
import PROFILE_AGGREGATE from './PROFILE_AGGREGATE';
55
import { SCHEMA_FIELD_TYPE } from './CREATE';
@@ -59,7 +59,7 @@ describe('PROFILE AGGREGATE', () => {
5959
assert.ok(shardProfile.includes('Warning'));
6060
assert.ok(shardProfile.includes('Iterators profile'));
6161

62-
}, GLOBAL.SERVERS.OPEN, skipTest);
62+
}, Object.assign(GLOBAL.SERVERS.OPEN, {skipTest: true}));
6363

6464
testUtils.testWithClientIfVersionWithinRange([[7, 2, 0], [7, 4, 0]], 'client.ft.search', async client => {
6565
await Promise.all([
@@ -106,5 +106,5 @@ describe('PROFILE AGGREGATE', () => {
106106
const normalizedRes = normalizeObject(res);
107107
assert.equal(normalizedRes.Results.total_results, 1);
108108
assert.ok(normalizedRes.Profile.Shards);
109-
}, GLOBAL.SERVERS.OPEN_3, skipTest);
109+
}, Object.assign(GLOBAL.SERVERS.OPEN_3, {skipTest: true}));
110110
});

packages/search/lib/test-utils.ts

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ import TestUtils from '@redis/test-utils';
22
import RediSearch from '.';
33
import { RespVersions } from '@redis/client';
44

5-
export const skipTest = true;
6-
75
export default TestUtils.createFromConfig({
86
dockerImageName: 'redislabs/client-libs-test',
97
dockerImageVersionArgument: 'redis-version',

packages/test-utils/lib/index.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ interface TestUtilsConfig {
5454
interface CommonTestOptions {
5555
serverArguments: Array<string>;
5656
minimumDockerVersion?: Array<number>;
57+
skipTest?: boolean;
5758
}
5859

5960
interface ClientTestOptions<
@@ -228,8 +229,7 @@ export default class TestUtils {
228229
>(
229230
title: string,
230231
fn: (client: RedisClientType<M, F, S, RESP, TYPE_MAPPING>) => unknown,
231-
options: ClientTestOptions<M, F, S, RESP, TYPE_MAPPING>,
232-
skipTest?: boolean,
232+
options: ClientTestOptions<M, F, S, RESP, TYPE_MAPPING>
233233
): void {
234234
let dockerPromise: ReturnType<typeof spawnRedisServer>;
235235
if (this.isVersionGreaterThan(options.minimumDockerVersion)) {
@@ -243,7 +243,7 @@ export default class TestUtils {
243243
}
244244

245245
it(title, async function () {
246-
if (skipTest) return this.skip();
246+
if (options.skipTest) return this.skip();
247247
if (!dockerPromise) return this.skip();
248248

249249
const client = createClient({
@@ -284,12 +284,11 @@ export default class TestUtils {
284284
range: ([minVersion: Array<number>, maxVersion: Array<number>] | [minVersion: Array<number>, 'LATEST']),
285285
title: string,
286286
fn: (client: RedisClientType<M, F, S, RESP, TYPE_MAPPING>) => unknown,
287-
options: ClientTestOptions<M, F, S, RESP, TYPE_MAPPING>,
288-
skipTest?: boolean
287+
options: ClientTestOptions<M, F, S, RESP, TYPE_MAPPING>
289288
): void {
290289

291290
if (this.isVersionInRange(range[0], range[1] === 'LATEST' ? [Infinity, Infinity, Infinity] : range[1])) {
292-
return this.testWithClient(`${title} [${range[0].join('.')}] - [${(range[1] === 'LATEST') ? range[1] : range[1].join(".")}] `, fn, options, skipTest)
291+
return this.testWithClient(`${title} [${range[0].join('.')}] - [${(range[1] === 'LATEST') ? range[1] : range[1].join(".")}] `, fn, options)
293292
} else {
294293
console.warn(`Skipping test ${title} because server version ${this.#VERSION_NUMBERS.join('.')} is not within range ${range[0].join(".")} - ${range[1] !== 'LATEST' ? range[1].join(".") : 'LATEST'}`)
295294
}
@@ -319,6 +318,7 @@ export default class TestUtils {
319318
}
320319

321320
it(title, async function () {
321+
if (options.skipTest) return this.skip();
322322
if (!dockerPromise) return this.skip();
323323

324324
const pool = createClientPool({

0 commit comments

Comments
 (0)