Skip to content

@ogma/nestjs-module: How to test controllers/services? #1538

Answered by jmcdo29
tukusejssirs asked this question in Q&A
Discussion options

You must be logged in to vote

If you use OgmaService directly you can just use a simple custom provider:

{
  provide: OgmaService,
  useValue: {
    log: jest.fn(),
    debug: jest.fn(),
    ...etc
  }
}

If you use @OgmaLogger() you can do the same as above but use createProviderToken() instead of OgmaService

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@tukusejssirs
Comment options

@jmcdo29
Comment options

@tukusejssirs
Comment options

@jmcdo29
Comment options

Answer selected by jmcdo29
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