From e8995e1b3ac8ea7f283451e9d8d8871501c6d83c Mon Sep 17 00:00:00 2001 From: LiaoLiao Date: Mon, 14 Jun 2021 20:18:37 +0800 Subject: [PATCH] build: add DOM to lib * see https://github.com/microsoft/TypeScript/issues/41727 --- lib/env-vars.spec.ts | 11 ----------- lib/redis/common/redis-utils.spec.ts | 2 +- lib/utils/index.spec.ts | 8 +------- lib/utils/index.ts | 6 +++--- tsconfig.json | 2 +- 5 files changed, 6 insertions(+), 23 deletions(-) delete mode 100644 lib/env-vars.spec.ts diff --git a/lib/env-vars.spec.ts b/lib/env-vars.spec.ts deleted file mode 100644 index 205ccb8e..00000000 --- a/lib/env-vars.spec.ts +++ /dev/null @@ -1,11 +0,0 @@ -test('redis host should be defined', () => { - expect(process.env.REDIS_HOST).toBeDefined(); -}); - -test('redis port should be defined', () => { - expect(process.env.REDIS_PORT).toBeDefined(); -}); - -test('redis password should be defined', () => { - expect(process.env.REDIS_PASSWORD).toBeDefined(); -}); diff --git a/lib/redis/common/redis-utils.spec.ts b/lib/redis/common/redis-utils.spec.ts index 1c70ad76..ab54e051 100644 --- a/lib/redis/common/redis-utils.spec.ts +++ b/lib/redis/common/redis-utils.spec.ts @@ -2,7 +2,7 @@ import IORedis, { Redis } from 'ioredis'; import { createClient, parseNamespace } from '.'; import { testConfig } from '../../utils'; -const url = `redis://:${testConfig.password}@127.0.0.1:${testConfig.port}/0`; +const url = `redis://:${testConfig.password ?? ''}@127.0.0.1:${testConfig.port}/0`; let client: Redis; diff --git a/lib/utils/index.spec.ts b/lib/utils/index.spec.ts index 5dc5bb07..556741ee 100644 --- a/lib/utils/index.spec.ts +++ b/lib/utils/index.spec.ts @@ -26,12 +26,6 @@ describe(`${promiseTimeout.name}`, () => { }); describe('testConfig', () => { - test('should contain host, port, and password', () => { - expect(testConfig).toHaveProperty('host'); - expect(testConfig).toHaveProperty('port'); - expect(testConfig).toHaveProperty('password'); - }); - test('the host should be of type string', () => { expect(typeof testConfig.host).toBe('string'); }); @@ -41,6 +35,6 @@ describe('testConfig', () => { }); test('the password should be of type string', () => { - expect(typeof testConfig.password).toBe('string'); + expect(typeof testConfig.password === 'string' || typeof testConfig.password === 'undefined').toBe(true); }); }); diff --git a/lib/utils/index.ts b/lib/utils/index.ts index 1b881fec..6aaeef22 100644 --- a/lib/utils/index.ts +++ b/lib/utils/index.ts @@ -21,7 +21,7 @@ export const promiseTimeout = (ms: number, promise: Promise): Promise