mirror of
https://github.com/benjamin-wilson/public-pool.git
synced 2026-09-29 17:15:03 -07:00
Migrate pool storage to TimescaleDB and Redis
This commit is contained in:
@@ -1,32 +1,59 @@
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
|
||||
import { AddressSettingsModule } from '../../ORM/address-settings/address-settings.module';
|
||||
import { ClientStatisticsModule } from '../../ORM/client-statistics/client-statistics.module';
|
||||
import { ClientModule } from '../../ORM/client/client.module';
|
||||
import { AddressSettingsService } from '../../ORM/address-settings/address-settings.service';
|
||||
import { ClientStatisticsService } from '../../ORM/client-statistics/client-statistics.service';
|
||||
import { ClientService } from '../../ORM/client/client.service';
|
||||
import { ShareAccountingService } from '../../ORM/share-accounting/share-accounting.service';
|
||||
import { RedisMessagingService } from '../../services/redis-messaging.service';
|
||||
import { ClientController } from './client.controller';
|
||||
|
||||
describe('ClientController', () => {
|
||||
let controller: ClientController;
|
||||
|
||||
beforeEach(async () => {
|
||||
const module: TestingModule = await Test.createTestingModule({
|
||||
imports: [
|
||||
TypeOrmModule.forRoot({
|
||||
type: 'better-sqlite3',
|
||||
database: ':memory:',
|
||||
synchronize: true,
|
||||
autoLoadEntities: true,
|
||||
cache: true,
|
||||
logging: false
|
||||
}),
|
||||
AddressSettingsModule,
|
||||
ClientModule,
|
||||
ClientStatisticsModule
|
||||
],
|
||||
controllers: [ClientController],
|
||||
beforeEach(async () => {
|
||||
const module: TestingModule = await Test.createTestingModule({
|
||||
controllers: [ClientController],
|
||||
providers: [
|
||||
{
|
||||
provide: ClientService,
|
||||
useValue: {
|
||||
getByAddress: jest.fn(),
|
||||
getByName: jest.fn(),
|
||||
getBySessionId: jest.fn(),
|
||||
},
|
||||
},
|
||||
{
|
||||
provide: ClientStatisticsService,
|
||||
useValue: {
|
||||
getChartDataForAddress: jest.fn(),
|
||||
getChartDataForGroup: jest.fn(),
|
||||
getChartDataForSession: jest.fn(),
|
||||
},
|
||||
},
|
||||
{
|
||||
provide: AddressSettingsService,
|
||||
useValue: {
|
||||
getSettings: jest.fn(),
|
||||
},
|
||||
},
|
||||
{
|
||||
provide: ShareAccountingService,
|
||||
useValue: {
|
||||
getAddressSummary: jest.fn(),
|
||||
getWorkerGroupSummary: jest.fn(),
|
||||
getSessionSummary: jest.fn(),
|
||||
getSessionSummaries: jest.fn().mockResolvedValue(new Map()),
|
||||
},
|
||||
},
|
||||
{
|
||||
provide: RedisMessagingService,
|
||||
useValue: {
|
||||
getClientPresenceByAddress: jest.fn().mockResolvedValue([]),
|
||||
},
|
||||
},
|
||||
],
|
||||
|
||||
}).compile();
|
||||
}).compile();
|
||||
|
||||
controller = module.get<ClientController>(ClientController);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user