Skip to content

Commit

Permalink
build: add DOM to lib
Browse files Browse the repository at this point in the history
  • Loading branch information
liaoliaots committed Jun 14, 2021
1 parent 5693609 commit e8995e1
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 23 deletions.
11 changes: 0 additions & 11 deletions lib/env-vars.spec.ts

This file was deleted.

2 changes: 1 addition & 1 deletion lib/redis/common/redis-utils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
8 changes: 1 addition & 7 deletions lib/utils/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});
Expand All @@ -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);
});
});
6 changes: 3 additions & 3 deletions lib/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const promiseTimeout = (ms: number, promise: Promise<unknown>): Promise<u
* Uses for testing.
*/
export const testConfig = {
host: process.env.REDIS_HOST as string,
port: Number.parseInt(process.env.REDIS_PORT as string, 10),
password: process.env.REDIS_PASSWORD as string
host: process.env.REDIS_HOST ?? '127.0.0.1',
port: Number.parseInt(process.env.REDIS_PORT ?? '6379', 10),
password: process.env.REDIS_PASSWORD
};
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"target": "ES2017",
"lib": ["ES2020"],
"lib": ["ES2020", "DOM"],
"sourceMap": false,
"outDir": "./dist",
"baseUrl": "./",
Expand Down

0 comments on commit e8995e1

Please sign in to comment.