mirror of
https://github.com/hexastack/hexabot
synced 2025-06-26 18:27:28 +00:00
feat(api): add automatic DI to migration module
This commit is contained in:
parent
b36d8939b2
commit
7a9face440
@ -10,12 +10,10 @@ import fs from 'fs';
|
||||
|
||||
import { HttpService } from '@nestjs/axios';
|
||||
import { ModuleRef } from '@nestjs/core';
|
||||
import { getModelToken, MongooseModule } from '@nestjs/mongoose';
|
||||
import { getModelToken } from '@nestjs/mongoose';
|
||||
|
||||
import { AttachmentService } from '@/attachment/services/attachment.service';
|
||||
import { LoggerService } from '@/logger/logger.service';
|
||||
import { MetadataRepository } from '@/setting/repositories/metadata.repository';
|
||||
import { Metadata, MetadataModel } from '@/setting/schemas/metadata.schema';
|
||||
import { Metadata } from '@/setting/schemas/metadata.schema';
|
||||
import { MetadataService } from '@/setting/services/metadata.service';
|
||||
import {
|
||||
closeInMongodConnection,
|
||||
@ -23,7 +21,7 @@ import {
|
||||
} from '@/utils/test/test';
|
||||
import { buildTestingMocks } from '@/utils/test/utils';
|
||||
|
||||
import { Migration, MigrationModel } from './migration.schema';
|
||||
import { Migration } from './migration.schema';
|
||||
import { MigrationService } from './migration.service';
|
||||
import { MigrationAction } from './types';
|
||||
|
||||
@ -34,13 +32,9 @@ describe('MigrationService', () => {
|
||||
|
||||
beforeAll(async () => {
|
||||
const { getMocks, resolveMocks } = await buildTestingMocks({
|
||||
imports: [
|
||||
rootMongooseTestModule(async () => await Promise.resolve()),
|
||||
MongooseModule.forFeature([MetadataModel, MigrationModel]),
|
||||
],
|
||||
autoInjectFrom: ['providers'],
|
||||
imports: [rootMongooseTestModule(async () => await Promise.resolve())],
|
||||
providers: [
|
||||
MetadataRepository,
|
||||
MetadataService,
|
||||
MigrationService,
|
||||
{
|
||||
provide: LoggerService,
|
||||
@ -53,10 +47,6 @@ describe('MigrationService', () => {
|
||||
provide: HttpService,
|
||||
useValue: {},
|
||||
},
|
||||
{
|
||||
provide: AttachmentService,
|
||||
useValue: {},
|
||||
},
|
||||
{
|
||||
provide: ModuleRef,
|
||||
useValue: {
|
||||
|
Loading…
Reference in New Issue
Block a user