Skip to content

Commit

Permalink
style(): minor format updates
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilmysliwiec committed May 24, 2020
1 parent 6135980 commit ea9d87c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
12 changes: 6 additions & 6 deletions tests/e2e/load-priority.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ describe('Environment variables and .env files', () => {
describe('without conflicts', () => {
beforeAll(async () => {
process.env['NAME'] = 'TEST';
const module = await Test.createTestingModule({
const moduleRef = await Test.createTestingModule({
imports: [AppModule.withEnvVars()],
}).compile();

app = module.createNestApplication();
app = moduleRef.createNestApplication();
await app.init();
});

Expand All @@ -31,11 +31,11 @@ describe('Environment variables and .env files', () => {
describe('with conflicts', () => {
beforeAll(async () => {
process.env['PORT'] = '8000';
const module = await Test.createTestingModule({
const moduleRef = await Test.createTestingModule({
imports: [AppModule.withEnvVars()],
}).compile();

app = module.createNestApplication();
app = moduleRef.createNestApplication();
await app.init();
});

Expand All @@ -48,13 +48,13 @@ describe('Environment variables and .env files', () => {
describe('with conflicts and schema validation', () => {
beforeAll(async () => {
process.env['PORT'] = '8000';
const module = await Test.createTestingModule({
const moduleRef = await Test.createTestingModule({
imports: [
AppModule.withSchemaValidation(join(__dirname, '.env.valid')),
],
}).compile();

app = module.createNestApplication();
app = moduleRef.createNestApplication();
await app.init();
});

Expand Down
14 changes: 6 additions & 8 deletions tests/e2e/optional-generic.spec.ts
Original file line number Diff line number Diff line change
@@ -1,34 +1,32 @@
import { INestApplication } from '@nestjs/common';
import { Test, TestingModule } from '@nestjs/testing';
import { AppModule } from '../src/app.module';
import { ConfigService } from '../../lib';
import { AppModule } from '../src/app.module';

describe('Optional Generic()', () => {
let app: INestApplication;
let module: TestingModule;
let moduleRef: TestingModule;

beforeEach(async () => {
module = await Test.createTestingModule({
moduleRef = await Test.createTestingModule({
imports: [AppModule.withEnvVars()],
}).compile();

app = module.createNestApplication();
app = moduleRef.createNestApplication();
await app.init();
});

it(`should allow a key of the interface`, () => {
const configService = module.get<ConfigService<{ PORT: string }>>(
const configService = moduleRef.get<ConfigService<{ PORT: string }>>(
ConfigService,
);

const port = configService.get('PORT');

expect(port).toBeTruthy();
});

it(`should allow any key without a generic`, () => {
const configService = module.get<ConfigService>(ConfigService);

const configService = moduleRef.get<ConfigService>(ConfigService);
const port = configService.get('PORT');

expect(port).toBeTruthy();
Expand Down

0 comments on commit ea9d87c

Please sign in to comment.