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 { HttpService } from '@nestjs/axios';
|
||||||
import { ModuleRef } from '@nestjs/core';
|
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 { LoggerService } from '@/logger/logger.service';
|
||||||
import { MetadataRepository } from '@/setting/repositories/metadata.repository';
|
import { Metadata } from '@/setting/schemas/metadata.schema';
|
||||||
import { Metadata, MetadataModel } from '@/setting/schemas/metadata.schema';
|
|
||||||
import { MetadataService } from '@/setting/services/metadata.service';
|
import { MetadataService } from '@/setting/services/metadata.service';
|
||||||
import {
|
import {
|
||||||
closeInMongodConnection,
|
closeInMongodConnection,
|
||||||
@ -23,7 +21,7 @@ import {
|
|||||||
} from '@/utils/test/test';
|
} from '@/utils/test/test';
|
||||||
import { buildTestingMocks } from '@/utils/test/utils';
|
import { buildTestingMocks } from '@/utils/test/utils';
|
||||||
|
|
||||||
import { Migration, MigrationModel } from './migration.schema';
|
import { Migration } from './migration.schema';
|
||||||
import { MigrationService } from './migration.service';
|
import { MigrationService } from './migration.service';
|
||||||
import { MigrationAction } from './types';
|
import { MigrationAction } from './types';
|
||||||
|
|
||||||
@ -34,13 +32,9 @@ describe('MigrationService', () => {
|
|||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
const { getMocks, resolveMocks } = await buildTestingMocks({
|
const { getMocks, resolveMocks } = await buildTestingMocks({
|
||||||
imports: [
|
autoInjectFrom: ['providers'],
|
||||||
rootMongooseTestModule(async () => await Promise.resolve()),
|
imports: [rootMongooseTestModule(async () => await Promise.resolve())],
|
||||||
MongooseModule.forFeature([MetadataModel, MigrationModel]),
|
|
||||||
],
|
|
||||||
providers: [
|
providers: [
|
||||||
MetadataRepository,
|
|
||||||
MetadataService,
|
|
||||||
MigrationService,
|
MigrationService,
|
||||||
{
|
{
|
||||||
provide: LoggerService,
|
provide: LoggerService,
|
||||||
@ -53,10 +47,6 @@ describe('MigrationService', () => {
|
|||||||
provide: HttpService,
|
provide: HttpService,
|
||||||
useValue: {},
|
useValue: {},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
provide: AttachmentService,
|
|
||||||
useValue: {},
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
provide: ModuleRef,
|
provide: ModuleRef,
|
||||||
useValue: {
|
useValue: {
|
||||||
|
Loading…
Reference in New Issue
Block a user