Skip to content

Mocking service that implements OnReady during integration tests #1690

Answered by Romakita
detroitpro asked this question in Q&A
Discussion options

You must be logged in to vote

try this :)

@OverrideProvider(WorkerService)
class MyWorkerService extends WorkerService {
    $onReady() {
       console.log('mocked')
    }
}

beforeEach(() => PlatformTest.bootstrap(Server, {
      typeorm: [
        {
          name: 'default',
          type: 'sqlite',
          database: ':memory:',
          dropSchema: true,
          synchronize: true,
          logging: false,
        },
      ],
    }));
  afterEach(PlatformTest.reset);

  it('should return runtime config', () => {
    const config = PlatformTest.injector.get<PlatformConfiguration>(PlatformConfiguration);
    console.debug(config); // testing throws here due to timeout.
  });

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by detroitpro
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants