Skip to content

Commit

Permalink
Merge pull request #97 from tazama-lf/env/validation
Browse files Browse the repository at this point in the history
feat: validate env
  • Loading branch information
rtkay123 authored Oct 1, 2024
2 parents 51157b2 + 9724b70 commit c0303a7
Show file tree
Hide file tree
Showing 4 changed files with 690 additions and 551 deletions.
9 changes: 7 additions & 2 deletions __tests__/nats.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import { StartupFactory } from '../src';
import { type responseCallback } from '../src/types/onMessageFunction';
import { startupConfig } from '../src/interfaces/iStartupConfig';

jest.mock('../src/interfaces/iStartupConfig', () => ({}));

beforeAll(async () => {
let server = {
servers: '',
Expand All @@ -14,6 +16,9 @@ beforeAll(async () => {

describe('init', () => {
let natsSpy: jest.SpyInstance;
beforeAll(() => {
process.env.STARTUP_TYPE = 'nats';
});
beforeEach(() => {
// natsSpy = jest.spyOn(MockNatsjs,'connect');
});
Expand All @@ -28,8 +33,8 @@ describe('init', () => {
// Done, so call response method
handleResponse(resp, []);
}
jest.mock('../src/interfaces/iStartupConfig', () => ({ startupType: 'jetstream' }));

startupConfig.startupType = 'jetstream';
const runServer = async (): Promise<void> => {
for (let retryCount = 0; retryCount < 10; retryCount++) {
let jsService = new StartupFactory();
Expand All @@ -52,7 +57,7 @@ describe('init', () => {
handleResponse(resp, []);
}

startupConfig.startupType = 'nats';
jest.mock('../src/interfaces/iStartupConfig', () => ({ startupType: 'nats' }));
const runServer = async (): Promise<void> => {
for (let retryCount = 0; retryCount < 10; retryCount++) {
let jsService = new StartupFactory();
Expand Down
Loading

0 comments on commit c0303a7

Please sign in to comment.