-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #226 from TogetherCrew/debug-hivemind-adapter
chore: update logs
- Loading branch information
Showing
3 changed files
with
76 additions
and
1 deletion.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
hivemind-adapter/src/bot-adapter/bot.adapter.service.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// src/bot-adapter/bot.adapter.service.spec.ts | ||
import { Test, TestingModule } from '@nestjs/testing' | ||
import { LoggerModule } from 'nestjs-pino' | ||
import { RabbitMQService } from '../rabbitmq/rabbitmq.service' | ||
import { BotAdapterService } from './bot.adapter.service' | ||
import { PlatformService } from '../platform/platform.service' | ||
|
||
const mockRabbitMQHost = 'mock-rabbitmq-host' | ||
const mockRabbitMQPort = 'mock-rabbitmq-port' | ||
const mockRabbitMQUser = 'mock-rabbitmq-user' | ||
const mockRabbitMQPassword = 'mock-rabbitmq-password' | ||
|
||
const mockRabbitMQService = { | ||
get: jest.fn((key: string) => { | ||
if (key === 'rabbitMQ.host') return mockRabbitMQHost | ||
if (key === 'rabbitMQ.port') return mockRabbitMQPort | ||
if (key === 'rabbitMQ.user') return mockRabbitMQUser | ||
if (key === 'rabbitMQ.password') return mockRabbitMQPassword | ||
}), | ||
} | ||
|
||
describe('BotAdapterService', () => { | ||
let service: BotAdapterService | ||
beforeAll(async () => { | ||
const module: TestingModule = await Test.createTestingModule({ | ||
imports: [LoggerModule.forRoot()], | ||
providers: [ | ||
BotAdapterService, | ||
PlatformService, | ||
{ provide: RabbitMQService, useValue: mockRabbitMQService }, | ||
], | ||
}).compile() | ||
|
||
service = module.get<BotAdapterService>(BotAdapterService) | ||
}) | ||
|
||
it('should be defined', () => { | ||
expect(service).toBeDefined() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
hivemind-adapter/src/hivemind-adapter/hivemind.adapter.service.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// src/hivemind-adapter/hivemind.adapter.service.spec.ts | ||
import { Test, TestingModule } from '@nestjs/testing' | ||
import { LoggerModule } from 'nestjs-pino' | ||
import { HivemindAdapterService } from './hivemind.adapter.service' | ||
import { RabbitMQService } from '../rabbitmq/rabbitmq.service' | ||
|
||
const mockRabbitMQHost = 'mock-rabbitmq-host' | ||
const mockRabbitMQPort = 'mock-rabbitmq-port' | ||
const mockRabbitMQUser = 'mock-rabbitmq-user' | ||
const mockRabbitMQPassword = 'mock-rabbitmq-password' | ||
|
||
const mockRabbitMQService = { | ||
get: jest.fn((key: string) => { | ||
if (key === 'rabbitMQ.host') return mockRabbitMQHost | ||
if (key === 'rabbitMQ.port') return mockRabbitMQPort | ||
if (key === 'rabbitMQ.user') return mockRabbitMQUser | ||
if (key === 'rabbitMQ.password') return mockRabbitMQPassword | ||
}), | ||
} | ||
|
||
describe('HivemindAdapterService', () => { | ||
let service: HivemindAdapterService | ||
beforeAll(async () => { | ||
const module: TestingModule = await Test.createTestingModule({ | ||
imports: [LoggerModule.forRoot()], | ||
providers: [HivemindAdapterService, { provide: RabbitMQService, useValue: mockRabbitMQService }], | ||
}).compile() | ||
|
||
service = module.get<HivemindAdapterService>(HivemindAdapterService) | ||
}) | ||
|
||
it('should be defined', () => { | ||
expect(service).toBeDefined() | ||
}) | ||
}) |