我正在尝试为 Nest 中的微服务编写 e2e 测试。我想我已经正确创建了 ProxyClient 以便向服务发出请求。
我在测试中试图做什么:
这是我到目前为止所拥有的......看起来很接近,但当我运行测试时我不断看到这一点。
预期:true,收到:{“_isScalar”:false,“operator”:{“concurrent”:Infinity,“project”:[函数匿名]},“source”:{“_isScalar”:false,“_subscribe”:[函数匿名]}}
import { Inject } from '@nestjs/common';
import { Test, TestingModule } from '@nestjs/testing';
import { ClientsModule, Transport, ClientProxy } from '@nestjs/microservices';
import * as request from 'supertest';
import { HeartbeatModule } from './../src/heartbeat.module';
import { HeartbeatService } from './../src/heartbeat.service';
describe('AppController (e2e)', () => {
let app;
let client: ClientProxy;
beforeEach(async () => {
const moduleFixture: TestingModule = await Test.createTestingModule({
imports: [HeartbeatModule, ClientsModule.register([{ name: 'HEARTBEAT_SERVICE', transport: Transport.TCP …
Run Code Online (Sandbox Code Playgroud)