title: Testing Class with @Injectable Scope / @Inject(REQUEST) NestJS
body: <p>I have set up a MongooseConfigService to allow us to dynamically switch out the connection string for certain requests and am trying to get the tests set up correctly.</p>
  <pre><code>@Injectable({scope: Scope.REQUEST})
  export class MongooseConfigService implements MongooseOptionsFactory {
    constructor(
      @Inject(REQUEST) private readonly request: Request) {
    }
  </code></pre>
  <p>I am however having trouble providing <code>request</code> to the test context.</p>
  <pre><code>  let service: Promise&lt;MongooseConfigService&gt;;
    
    beforeEach(async () =&gt; {
      const req = new JestRequest();
      
      const module: TestingModule = await Test.createTestingModule({
        providers: [
          MongooseConfigService,
          {
            provide: getModelToken(REQUEST),
            inject: [REQUEST],
            useFactory: () =&gt; ({
              request: req,
            }),
          },
        ],
      }).compile();
      
      service = module.resolve&lt;MongooseConfigService&gt;(MongooseConfigService);
    });
  </code></pre>
  <p>This is as far as I have gotten, have tried it without the <code>inject</code> and with/without <code>useValue</code>, however <code>this.request</code> remains undefined when trying to run the tests.</p>
  <p>TIA</p>